Skip to content

Commit 36cce43

Browse files
authored
Merge pull request #8 from code-rabi/benr/feat-doc-scope
chore: update docs
2 parents 1af05b5 + 50050d6 commit 36cce43

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
## Table of Contents
77

8+
- [When and why to use Toolception](#when-and-why-to-use-toolception)
89
- [Starter guide](#starter-guide)
910
- [Static startup](#static-startup)
1011
- [API](#api)
@@ -14,6 +15,49 @@
1415
- [Startup modes](#startup-modes)
1516
- [License](#license)
1617

18+
## When and why to use Toolception
19+
20+
Building MCP servers with dozens or hundreds of tools often harms LLM performance and developer experience:
21+
- **Too many tools overwhelm selection**: Larger tool lists increase confusion and mis-selection rates.
22+
- **Token and schema bloat**: Long tool catalogs inflate prompts and latency.
23+
- **Name collisions and ambiguity**: Similar tool names across domains cause failures and fragile integrations.
24+
- **Operational overhead**: Loading every tool up-front wastes resources; many tools are task-specific.
25+
26+
Toolception addresses this by grouping tools into toolsets and letting you expose only what’s needed, when it’s needed.
27+
28+
### When to use Toolception
29+
- **Large or multi-domain catalogs**: You have >20–50 tools or multiple domains (e.g., search, data, billing) and don’t want to expose them all at once.
30+
- **Task-specific workflows**: You want the client/agent to enable only the tools relevant to the current task.
31+
- **Multi-tenant or policy needs**: Different users/tenants require different tool access or limits.
32+
- **Collision-safe naming**: You need predictable, namespaced tool names to avoid conflicts.
33+
- **Lazy loading**: Some tools are heavy and should be loaded on demand.
34+
35+
### Why Toolception helps
36+
- **Toolsets**: Group related tools and expose minimal, coherent subsets per task.
37+
- **Dynamic mode (runtime control)**:
38+
- Enable toolsets on demand via meta-tools (`enable_toolset`, `disable_toolset`, `list_toolsets`, `describe_toolset`, `list_tools`).
39+
- Reduce prompt/tool surface area → better tool selection and lower latency.
40+
- Lazy-load module-produced tools only when needed; pass shared `context` safely to loaders.
41+
- Supports `tools.listChanged` notifications so clients can react to updated tool lists.
42+
- **Static mode (predictable startup)**:
43+
- Preload known toolsets (or ALL) at startup for fixed pipelines and simpler environments.
44+
- Keep only the required sets for your deployment footprint.
45+
- **Exposure policy**:
46+
- **maxActiveToolsets**: Cap concurrently active sets to prevent bloat.
47+
- **allowlist/denylist**: Enforce which toolsets can be enabled.
48+
- **namespaceToolsWithSetKey**: Default on; registers tools as `set.tool` to avoid collisions and clarify intent.
49+
- **Operational safety**:
50+
- Central `ToolRegistry` validates names and prevents collisions.
51+
- `ModuleLoaders` are deterministic/idempotent for repeatable runs and caching.
52+
53+
### Choosing a mode
54+
- **Prefer DYNAMIC** when tool needs vary by task, you want tighter prompts, or you need runtime gating and lazy loading.
55+
- **Choose STATIC** when your tool needs are stable and small, or when your client cannot (or should not) perform runtime enable/disable operations.
56+
57+
### Typical flows
58+
- **Discovery-first (dynamic)**: Client calls `list_toolsets` → enables a set → calls namespaced tools (e.g., `core.ping`).
59+
- **Fixed pipeline (static)**: Server preloads named toolsets (or ALL) at startup; clients call `list_tools` and invoke as usual.
60+
1761
## Starter guide
1862

1963
### Step 1: Install

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "toolception",
3-
"version": "0.2.4",
3+
"version": "0.2.5",
44
"private": false,
55
"type": "module",
66
"main": "dist/index.js",

0 commit comments

Comments
 (0)