What you will be able to do
- Quantify the per-request cost of loading every tool definition up front, and name the tool count where selection accuracy starts to slip
- Configure tool search with defer_loading and explain how tool_reference blocks bring deferred tools into context
- Set ENABLE_TOOL_SEARCH in the Agent SDK and predict when each value loads tools up front
- Choose between a fixed tool set, tool search, Skills and a hybrid for a given agent, weighing search round-trips against context saved
Key concept
Progressive discovery — Only lightweight entry points stay in context, such as a search tool or a Skill's name and description. Full definitions and instructions load when a request needs them. A monolithic strategy does the opposite: it loads everything on every request, whether or not that request uses it.
1.What a monolithic tool set costs before any work starts
A monolithic context strategy puts every tool definition into the context window on every request. That is the baseline that progressive discovery is measured against. Tool definitions count toward the context window just as messages do. The full cost of carrying too many tools is covered in Capability bloat: what too many tools cost. The angle here is how large that fixed cost gets. A typical multiserver setup that connects GitHub, Slack, Sentry, Grafana and Splunk can use about 55k tokens on definitions before Claude does anything useful. The Agent SDK documentation gives a smaller rule of thumb: 50 tools can take 10–20K tokens.
Tokens are only half of the cost. Claude's ability to pick the right tool degrades once more than 30–50 tools are available at the same time. An agent that worked well with two MCP servers can start choosing the wrong tool after a third or fourth server is connected, even though no single tool changed. Context rot adds to this. As the token count grows, accuracy and recall both decline, so a large block of mostly unused definitions also makes everything else in the window harder to use.
A larger context window does not fix either problem. More room lets the 55k tokens fit, but it does not restore selection accuracy, and context rot gets worse as the window fills. What matters is how much is in context, not how much space is left over.
Checkpoint 1 of 9· Check yourself
An agent connected to GitHub, Slack, Sentry, Grafana and Splunk MCP servers loads every tool definition up front, which is about 55k tokens. Since the last two servers were added, it often calls the wrong tool. A teammate suggests switching to a model with a much larger context window. What happens?
A bigger window adds room but does not shrink the tool set. Selection accuracy depends on how many tools are loaded at the same time, across all servers, and accuracy and recall fall as the token count grows. Tool definitions count toward the window on every request.
“A larger context window allows the model to handle more complex and lengthy prompts, but more context isn't automatically better.”Source: platform.claude.com
Checkpoint 2 of 9· Exam question
During testing, an engineering team notices that Claude increasingly selects the wrong tool as more MCP servers are connected to their agent. At what approximate number of simultaneously loaded tools does tool selection accuracy begin to noticeably degrade?
Correct answer: A — Between 30 and 50 tools
- A. Correct. Documentation states tool selection accuracy degrades once more than roughly 30-50 tools are loaded into context at once, which is one of the two core reasons to adopt progressive discovery.
- B. Toolsets this small are well within the range where monolithic loading works fine; accuracy degradation is not documented at this scale.
- C. This range is well past the documented degradation threshold; by this point an agent should already be using tool search rather than just approaching a limit.
- D. This range far exceeds the documented threshold and approaches the catalog-size limits tool search is designed to handle, not the point where accuracy first degrades.
2.How tool search keeps deferred tools out of context
Tool search is the API's progressive-discovery mechanism for tools. It replaces the monolithic catalogue with a search step. Tool search typically cuts the definition footprint by over 85 percent, loading only the 3–5 tools a given request needs. Because Claude chooses from a short, relevant list, selection accuracy stays high even when the catalogue holds thousands of tools.
Tool search comes in two variants. With the regex variant (tool_search_tool_regex_20251119), Claude writes regex patterns. With the BM25 variant (tool_search_tool_bm25_20251119), Claude writes natural-language queries. Both search tool names, descriptions, argument names and argument descriptions, so well-written descriptions are what make a tool findable. To enable tool search, add one of the variants to the tools list and mark the tools that should stay out of context with defer_loading: true.
{
"name": "get_weather",
"description": "Get current weather for a location",
"input_schema": {
"type": "object",
"properties": {
"location": { "type": "string" },
"unit": { "type": "string", "enum": ["celsius", "fahrenheit"] }
},
"required": ["location"]
},
"defer_loading": true
}defer_loading decides what goes into Claude's context window, not what goes into the request. At the start, Claude's context holds only the search tool and any tools that are not deferred. When Claude needs something else, it calls the search tool. The search runs on Anthropic's servers and returns the matching tools as tool_reference blocks, five by default. Claude can set a limit between 1 and 10,000. The API then expands each reference into the full tool definition before Claude sees it. You never do the expansion yourself.
{
"type": "server_tool_use",
"id": "srvtoolu_01ABC123",
"name": "tool_search_tool_regex",
"input": {
"pattern": "weather",
"limit": 10
}
},
{
"type": "tool_search_tool_result",
"tool_use_id": "srvtoolu_01ABC123",
"content": {
"type": "tool_search_tool_search_result",
"tool_references": [{ "type": "tool_reference", "tool_name": "get_weather" }]
}
}The conversation loop has a few rules that are easy to break:
- Send the assistant content back unchanged, including the
server_tool_useandtool_search_tool_resultblocks. - Never return a
tool_resultfor thesrvtoolu_...ID. The API rejects the request. - Execute the discovered tool's ordinary
tool_useand return itstool_resultas normal. - Expect an empty
tool_referencesarray, not an error, when a search matches nothing.
Discovered tools stay available after they are found. The API expands tool_reference blocks throughout the conversation history, so Claude can call a tool again in later turns without searching for it again. Deferred tools are also left out of the system-prompt prefix, and their references are added inline. The prefix therefore does not change and prompt caching keeps working. At least one tool, normally the search tool itself, must stay non-deferred. Never set defer_loading: true on the search tool.
Checkpoint 3 of 9· Fill the gap
This tool definition is sent in the tools array alongside a tool search tool. Which property keeps the tool out of Claude's context window until a search finds it?
{
"name": "get_weather",
"description": "Get current weather for a location",
"input_schema": {
"type": "object",
"properties": {
"location": { "type": "string" },
"unit": { "type": "string", "enum": ["celsius", "fahrenheit"] }
},
"required": ["location"]
},
" ? ": true
}Setting defer_loading: true leaves the definition out of Claude's context until tool search returns it as a tool_reference. Your request still sends the full definition every time. cache_control only lowers the price of repeated tokens, and strict only constrains the output to the schema. Neither one removes a definition from context.
Source: platform.claude.comCheckpoint 4 of 9· Check yourself
Claude's response holds three blocks: a server_tool_use block with ID srvtoolu_01ABC123, the tool_search_tool_result for that call, and a tool_use block calling get_weather with ID toolu_01XYZ789. What should your next request contain?
The search blocks have to stay in the history unchanged so the API can keep expanding the tool_reference. Only the discovered tool's tool_use gets a tool_result. The API rejects a tool_result for the srvtoolu_ ID, and every deferred definition must still be sent on every request.
“On the next request, pass the assistant's content back unchanged, including the server_tool_use and tool_search_tool_result blocks.”Source: platform.claude.com
Sources1
3.Turning tool search on in the Agent SDK with ENABLE_TOOL_SEARCH
In the Agent SDK, tool search is set by the ENABLE_TOOL_SEARCH environment variable, which you pass through the env option. On Claude Opus 4.5, Sonnet 4.5, Haiku 4.5 and later models, tool search is on by default. This matters when you connect a large MCP server: its tools are deferred automatically unless you choose otherwise. Each value decides whether definitions are deferred or loaded up front.
| Value | Behavior |
|---|---|
| (unset) | Tool search on; definitions deferred. Falls back to loading up front on older models, a non-first-party ANTHROPIC_BASE_URL, or a Microsoft Foundry deployment hosted on Azure |
| true | Keeps tool search on even with a non-first-party ANTHROPIC_BASE_URL; requests fail on proxies that don't support tool_reference blocks |
| auto | Activates only when deferrable definitions reach 10% of the model's context window; below that, everything loads up front |
| auto:N | Same as auto with a custom threshold; auto:5 activates at 5% |
| false | Off; all tool definitions loaded into context on every turn |
auto turns the choice between strategies into a measured threshold. It counts the tokens in the deferrable definitions and compares the total with the model's context window. A small tool set therefore stays monolithic, and a growing one switches to search without a code change. A lower N switches sooner. false forces the monolithic strategy on every turn. In the SDK, a catalogue can hold up to 10,000 tools, and each search returns the five most relevant by default.
No. auto activates only when the deferrable definitions reach 10% of the context window. At 3%, the SDK loads every definition into context up front. To defer them anyway, use a lower threshold such as auto:2.
Checkpoint 5 of 9· Match them up
Match each ENABLE_TOOL_SEARCH value to how the Agent SDK then treats tool definitions.
Tap a term, then the definition that fits it.
Only false always loads everything, and only auto or auto:N tie deferral to a measured share of the context window. Below the threshold, auto still loads every definition up front. Leaving the variable unset defers by default but falls back behind a non-first-party base URL, and true overrides that fallback.
“When the total reaches 10% of the window, tool search activates. Below that, the SDK loads every tool definition into context upfront.”Source: code.claude.com
Sources2
4.Choosing progressive discovery or a fixed tool set
The rule of thumb is to load a small, frequently used tool set up front and to use progressive discovery for large or rarely used catalogues. The cost of tool search is latency: Claude needs one extra turn to look up a tool before calling it. In return, baseline context usage drops sharply. That trade pays off for toolsets of about 20 or more tools where most aren't needed on every turn. It does not pay off when every tool is used constantly.
| Situation | Strategy | Reason |
|---|---|---|
| A handful of tools, nearly all used on almost every request | Load all up front (no tool search) | A search round-trip would precede calls to tools Claude needs anyway, and little context is saved |
| Roughly 20+ tools, most idle on any given turn | Tool search with defer_loading on the long tail | Large cut in baseline context for one extra lookup turn |
| Large catalogue with a few heavy-use tools | Tool search, with the 3–5 most frequent tools non-deferred | Common calls skip the search; rare tools stay out of context |
| Large but fixed toolset across many requests | Prompt caching (alone or with tool search) | Reduces what you pay for repeated definitions, not how many tokens sit in context |
Take an internal agent with seven tools, about 1,200 tokens of definitions, and nearly every tool used on every request. Deferring those tools would add a search before calls Claude was always going to make, to save tokens that barely register. Keep them all loaded. The guidance to keep the 3–5 most-used tools non-deferred points the same way: whenever a tool is likely to be needed, it belongs in context.
The 55k-token multiserver agent is the opposite case. Tool search is the fix there, because it is the only option that removes definitions from context. Prompt caching makes repeated definitions cheaper, but every token still sits in context and the agent still chooses among dozens of tools. Rewriting every description by hand shrinks the definitions somewhat, but it leaves the tool count as it was and makes search worse, because names and descriptions are exactly what the search matches against. The approaches can be combined: tool search keeps the set lean, and caching lowers the cost of what stays loaded.
Checkpoint 6 of 9· Match them up
For each tool set, pick the loading strategy that the trade-off between search latency and context size favours.
Tap a term, then the definition that fits it.
Tool search costs one extra lookup turn, so it only pays off when most tools go unused on a given turn. Tools that are used constantly should stay loaded. Prompt caching only lowers what you pay for repeated definitions. Every cached token still sits in context, so caching alone never fixes context bloat.
“Prompt caching doesn't reduce the number of tokens in context, but it reduces what you pay for them on subsequent requests.”Source: platform.claude.com
Checkpoint 7 of 9· Exam question
A team builds an internal agent that calls exactly 7 tools, nearly all of which are needed on almost every request, and the combined tool definitions total roughly 1,200 tokens. Which context strategy should they use for tool loading?
Correct answer: A — Load all seven tool definitions into context on every turn, since the toolset is small and every tool is used regularly.
- A. Correct. With fewer than roughly 10 tools whose definitions fit comfortably in context, loading everything upfront (monolithic loading) is typically faster than paying the extra search round-trip that tool search introduces.
- B. Tool search exists to solve context bloat and selection accuracy problems that appear at larger tool counts (dozens to thousands); for 7 small, frequently-used tools it adds an unnecessary search step.
- C. Deferring every tool, including in a setup this small, adds a search round-trip on tools that are needed almost every request, and at least one tool must stay non-deferred for search to even function.
- D. Splitting a 7-tool, 1,200-token catalog across servers and enabling search on each adds architectural complexity and search overhead with no context-bloat problem to solve.
Checkpoint 8 of 9· Exam question
An enterprise agent aggregates tool catalogs from GitHub, Slack, Sentry, Grafana, and Splunk MCP servers, and the combined tool definitions consume about 55,000 tokens before the agent does any work. Which strategy best addresses this context bloat?
Correct answer: A — Enable tool search so Claude discovers and loads only the three to five tools relevant to each request instead of loading every definition upfront.
- A. Correct. This is exactly the scenario tool search is built for: a multi-server aggregation around 55k tokens of definitions, where deferred loading and on-demand discovery of 3-5 relevant tools typically cuts context consumption by over 85 percent.
- B. Context window size is fixed per model and is not something a developer can raise; this does not address the underlying bloat from loading every definition upfront.
- C. Manually trimming descriptions to fit is not the documented approach and risks degrading the descriptive detail that tool search itself relies on for accurate matching.
- D. Prompt caching reduces re-processing cost for repeated content but does not remove the 55,000 tokens of tool definitions from the context window on the turns where they are still loaded.
5.Skills and hybrid loading as other forms of progressive discovery
Tool search is not the only way to load context on demand. Agent Skills do the same thing for instructions and reference material. Skills load in three levels, described in Progressive disclosure in Skills (three loading levels): metadata at startup, then the SKILL.md body when the Skill triggers, then bundled files when they are read. What matters for this choice is the always-on cost. Each Skill keeps about 100 tokens of name and description in the system prompt, so many Skills can be installed without paying for content nobody is using.
Tool search and Skills solve different problems. Tool search defers tool schemas, and the API finds and expands them through tool_reference blocks. Skills defer know-how: workflows, schemas and scripts. Claude reads them from a filesystem with bash, and only a script's output enters context, never its code. A large catalogue of actions points to tool search. A large body of procedures and reference documents points to Skills. Skills need the code execution environment to work. Tool search needs a model that supports it, and Claude Opus 4.1 and earlier do not.
A hybrid often works best. Claude Code puts CLAUDE.md files into context up front and uses glob and grep to pull in other files only when they are needed. On-demand exploration has a cost of its own: it is slower than reading data that was retrieved in advance, and an agent with poor guidance can waste context on dead ends. So load what nearly every request needs, and defer the rest.
Checkpoint 9 of 9· Check yourself
A compliance team wants its agent to follow about 60 internal procedures. Each one has a written workflow, a reference schema and a validation script, but any single request uses only one or two of them. Which approach keeps the always-on context cost lowest while still giving Claude the procedures when it needs them?
Skills defer know-how such as workflows, schemas and scripts. Each untriggered Skill costs only about 100 tokens of metadata, and a script's output enters context but its code does not. Tool search defers tool schemas, not procedures. Caching and bigger windows leave every token in context.
“This lightweight approach means you can install many Skills without context penalty: until a Skill is triggered, only its name and description occupy context.”Source: platform.claude.com
Sources
(6)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“A typical multiserver setup (GitHub, Slack, Sentry, Grafana, and Splunk) can consume ~55k tokens in definitions before Claude does any work.”
↩︎ What a monolithic tool set costs before any work starts“Claude's ability to pick the right tool degrades once you exceed 30–50 available tools.”
↩︎ What a monolithic tool set costs before any work starts“Tool search typically reduces this by over 85 percent, loading only the 3–5 tools Claude needs for a given request.”
↩︎ How tool search keeps deferred tools out of context“BM25 (tool_search_tool_bm25_20251119): Claude uses natural language queries to search for tools.”
↩︎ How tool search keeps deferred tools out of context“Initially, Claude's context contains only the tool search tool and any non-deferred tools.”
↩︎ How tool search keeps deferred tools out of context“The API runs the search and returns the matching tools as tool_reference blocks”
↩︎ How tool search keeps deferred tools out of context“The API expands tool_reference blocks throughout the conversation history, so Claude can reuse discovered tools in later turns without re-searching.”
↩︎ How tool search keeps deferred tools out of context“The prefix is untouched, so prompt caching is preserved.”
↩︎ How tool search keeps deferred tools out of context“A search that matches nothing returns a tool_search_tool_search_result with an empty tool_references array, not an error.”
↩︎ How tool search keeps deferred tools out of context“Keep your 3–5 most frequently used tools non-deferred so Claude can call them without searching first.”
↩︎ Choosing progressive discovery or a fixed tool set“Claude Opus 4.1 and earlier models don't support the tool search tool.”
↩︎ Skills and hybrid loading as other forms of progressive discovery“Instead of loading all tool definitions into the context window up front, Claude searches your tool catalog”
↩︎ Key concept“You still send every tool's full definition in the tools array on every request, including the deferred ones.”
↩︎ Exam trap 2“Keep your 3–5 most frequently used tools non-deferred so Claude can call them without searching first.”
↩︎ Exam trap 3“You still send every tool's full definition in the tools array on every request, including the deferred ones.”
↩︎ Prediction“On the next request, pass the assistant's content back unchanged, including the server_tool_use and tool_search_tool_result blocks.”
↩︎ Checkpoint - 2.
“50 tools can use 10-20K tokens”
↩︎ What a monolithic tool set costs before any work starts“Claude Opus 4.5, Sonnet 4.5, Haiku 4.5, and later: tool search is on by default.”
↩︎ Turning tool search on in the Agent SDK with ENABLE_TOOL_SEARCH“Tool search is off. All tool definitions are loaded into context on every turn.”
↩︎ Turning tool search on in the Agent SDK with ENABLE_TOOL_SEARCH“Maximum tools: 10,000 tools in your catalog”
↩︎ Turning tool search on in the Agent SDK with ENABLE_TOOL_SEARCH“When the total reaches 10% of the window, tool search activates.”
↩︎ Exam trap 4“When the total reaches 10% of the window, tool search activates. Below that, the SDK loads every tool definition into context upfront.”
↩︎ Checkpoint - 3.
“As token count grows, accuracy and recall degrade, a phenomenon known as context rot.”
↩︎ What a monolithic tool set costs before any work starts“A larger context window allows the model to handle more complex and lengthy prompts, but more context isn't automatically better.”
↩︎ Checkpoint - 4.
“This trades a small amount of latency (one extra turn to look up a tool) for a large reduction in baseline context usage.”
↩︎ Choosing progressive discovery or a fixed tool set“Large toolsets (20+ tools) where most tools aren't needed every turn”
↩︎ Choosing progressive discovery or a fixed tool set“These approaches compose.”
↩︎ Choosing progressive discovery or a fixed tool set“Prompt caching doesn't reduce the number of tokens in context, but it reduces what you pay for them on subsequent requests.”
↩︎ Exam trap 1“Prompt caching doesn't reduce the number of tokens in context, but it reduces what you pay for them on subsequent requests.”
↩︎ Checkpoint - 5.
“This lightweight approach means you can install many Skills without context penalty: until a Skill is triggered, only its name and description occupy context.”
↩︎ Skills and hybrid loading as other forms of progressive discovery“Prerequisites: Using Skills through the API requires the code execution tool, whose container Skills run in.”
↩︎ Skills and hybrid loading as other forms of progressive discovery - 6.
“CLAUDE.md files are naively dropped into context up front”
↩︎ Skills and hybrid loading as other forms of progressive discovery“runtime exploration is slower than retrieving pre-computed data.”
↩︎ Skills and hybrid loading as other forms of progressive discovery