What you will be able to do
- Name the two costs of loading every tool definition into context up front, and the numbers the documentation gives for each
- Explain how defer_loading, the tool search tool and tool_reference expansion let Claude find tools on demand
- Choose between progressive discovery (tool search) and a fixed, cached toolset based on how big the toolset is and how often it changes
Key concept
Progressive discovery (on-demand loading) — Claude's context starts with only a small entry point, such as a search tool or a list of short descriptions. Full definitions or instructions load only when the current task needs them. The monolithic approach does the opposite and puts everything in context on every turn, whether or not it gets used.
1.What a monolithic toolset costs
The simplest way to give an agent capabilities is to put every tool definition in the request and let all of them load into context. Call this the monolithic strategy. It works for a handful of tools. As the library grows, the tool search documentation describes two separate ways it breaks down.
The first is context bloat. Definitions use up tokens before Claude has done anything. The documentation's example is a typical multiserver setup with GitHub, Slack, Sentry, Grafana and Splunk, which can consume ~55k tokens in definitions alone. The Agent SDK documentation gives a smaller-scale version: 50 tools can use 10–20K tokens, which leaves less room for the work itself.
The second is tool selection accuracy. Beyond 30–50 available tools, Claude gets worse at choosing the right one. The extra definitions add noise as well as cost.
Progressive discovery addresses both. Tool search typically reduces definition tokens by over 85 percent and loads only the 3–5 tools a given request needs. Because Claude only ever sees a small, relevant set, selection accuracy stays high even across a catalog of thousands of tools. The SDK documentation gives the ceiling as 10,000 tools per catalog.
Checkpoint 1 of 6· Check yourself
A team connects GitHub, Slack, Sentry, Grafana and Splunk MCP servers and loads every tool definition up front. Which pair of problems does the tool search documentation say this causes?
The documentation names exactly two problems: definitions consume context before any work starts (~55k tokens in this example), and selection accuracy degrades past 30–50 tools.
“Context bloat: A typical multiserver setup (GitHub, Slack, Sentry, Grafana, and Splunk) can consume ~55k tokens in definitions before Claude does any work.”Source: platform.claude.com
2.How tool search works: defer_loading and tool_reference
On the Claude API, progressive discovery is built into the tool search tool. It runs on the server and comes in two variants. With tool_search_tool_regex_20251119, Claude writes regex patterns. With tool_search_tool_bm25_20251119, Claude writes natural-language queries. Both search tool names, descriptions, argument names and argument descriptions. Claude Opus 4.1 and earlier don't support it.
You add the search tool to your tools array and mark the tools that shouldn't load up front with defer_loading: true. The flag is easy to misread. It controls what goes into the context window, not what goes into the request. You still send every full definition on every request, deferred ones included, because the API needs them on the server to run the search and to expand the results.
This is not all-or-nothing. At least one tool has to stay non-deferred, normally the search tool itself, and you must never defer the search tool. The documentation also recommends keeping your 3–5 most frequently used tools non-deferred so Claude can call them without searching first. In practice, then, progressive discovery is a hybrid: a small core that is always loaded, with a searchable catalog behind it.
{
"type": "tool_search_tool_regex_20251119",
"name": "tool_search_tool_regex"
}Checkpoint 2 of 6· Fill the gap
Which field keeps this tool's definition out of Claude's context 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
}defer_loading: true makes a tool load only when Claude discovers it through search. The full definition is still sent in the tools array.
Source: platform.claude.comAt runtime, Claude's context initially holds only the search tool and any non-deferred tools. When Claude needs something else, it calls the search tool. The API returns matches as tool_reference blocks (five by default) and expands them into full definitions itself; you never do this expansion. Claude then calls the discovered tool as a normal tool_use, and you return a tool_result as usual. The search call is a server_tool_use with a srvtoolu_... ID, and you never return a tool_result for it.
Two details remove the usual objections to dynamic tool sets. Deferred tools are kept out of the system-prompt prefix, and discovered tools are appended inline in the conversation, so prompt caching is preserved. Expanded references also persist across the conversation history, so Claude can reuse a tool in later turns without searching again.
Checkpoint 3 of 6· Put it in order
Put the tool search flow in order, from configuration to calling the tool.
- 1.The API expands the references into full tool definitions
- 2.Claude selects from the discovered tools and calls them
- 3.Claude's context contains only the tool search tool and any non-deferred tools
- 4.Include a tool search tool in the tools list and set defer_loading: true on tools that shouldn't load up front
- 5.The API returns matching tools as tool_reference blocks
- 6.Claude searches using the tool search tool when it needs additional tools
The documentation lists these steps in this order: configure, start with a minimal context, search, get references back, expand them automatically, then call the tool.
“The API runs the search and returns the matching tools as tool_reference blocks”Source: platform.claude.com
Checkpoint 4 of 6· 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.
Sources1
3.Choosing between progressive discovery and a fixed toolset
Progressive discovery isn't free. The manage-tool-context guide describes the trade plainly: one extra turn to look up a tool, in exchange for a large cut in baseline context use. So the real question is whether your toolset is large enough, and used unevenly enough, that the cut is worth the extra turn.
The guide's comparison answers this. Tool search fits large toolsets of 20+ tools where most tools aren't needed on every turn. Prompt caching is the better fit when the toolset is large but fixed. Caching doesn't reduce the number of tokens in context, but it reduces what you pay for them on later requests. A monolithic toolset that stays stable and is cached is therefore a legitimate design. What it doesn't fix is the selection-accuracy problem past 30–50 tools, because every definition is still in front of Claude.
The two strategies also combine. The recommended starting point for a high-volume agent is to enable prompt caching on tool definitions from day one, then add tool search once the toolset grows past roughly 20 tools or baseline context use becomes noticeable.
| Dimension | Monolithic toolset + prompt caching | Progressive discovery (tool search) |
|---|---|---|
| What it reduces | What you pay for repeated tool definitions | Tool definitions loaded upfront |
| Tokens in context | Unchanged: every definition loads on every turn | Search tool, non-deferred tools, and the 3–5 tools discovered for this request |
| Best fit | Stable toolsets across many requests | Large toolsets (20+ tools) where most tools aren't needed every turn |
| Latency cost | None added | One extra turn to look up a tool |
| Selection accuracy | Degrades once you exceed 30–50 available tools | Stays high even across thousands of tools |
Checkpoint 5 of 6· Check yourself
An agent has 15 tools. The set never changes, nearly every tool is used in most conversations, and the agent handles thousands of requests a day. Which approach does the guidance point to first?
The toolset is below the ~20-tool point where tool search starts to pay off, it's fixed, and its tools are used on most turns. That is the case caching is built for. Tool search would add a lookup turn and save very little.
“This is the right choice when the toolset is large but fixed.”Source: platform.claude.com
Checkpoint 6 of 6· 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.
Sources3
Exam traps
Each one states something that sounds right. Open it to see what is actually true.
1.Setting defer_loading: true means you can leave that tool's definition out of later requests.Why is that wrong?
defer_loading only controls what enters the context window. Every full definition must still be sent on every request so the API can run the search and expand tool_reference blocks.
Covered in How tool search works: defer_loading and tool_reference
2.For maximum savings, defer every tool, including the search tool and the ones you use most.Why is that wrong?
The search tool must never be deferred, and the guidance is to keep your 3–5 most frequently used tools loaded so Claude doesn't spend a search turn on them.
Covered in How tool search works: defer_loading and tool_reference
3.Prompt caching solves the same problem as tool search, so a cached monolithic toolset is just as lean in context.Why is that wrong?
Caching lowers the price of repeated definitions but leaves the token count in context unchanged. Only tool search removes definitions from context.
Covered in Choosing between progressive discovery and a fixed toolset
Sources
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Tool search typically reduces this by over 85 percent, loading only the 3–5 tools Claude needs for a given request.”
↩︎ What a monolithic toolset costs“Because tool search loads only a focused set of relevant tools on demand, selection accuracy stays high even across thousands of tools.”
↩︎ What a monolithic toolset costs“Never set defer_loading: true on the tool search tool itself.”
↩︎ How tool search works: defer_loading and tool_reference“Initially, Claude's context contains only the tool search tool and any non-deferred tools.”
↩︎ How tool search works: defer_loading and tool_reference“The prefix is untouched, so prompt caching is preserved.”
↩︎ How tool search works: defer_loading and tool_reference“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 works: defer_loading and tool_reference“Never return a tool_result for its srvtoolu_... ID.”
↩︎ How tool search works: defer_loading and tool_reference“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 1“Keep your 3–5 most frequently used tools non-deferred so Claude can call them without searching first.”
↩︎ Exam trap 2“Claude's ability to pick the right tool degrades once you exceed 30–50 available tools.”
↩︎ Prediction“Context bloat: A typical multiserver setup (GitHub, Slack, Sentry, Grafana, and Splunk) can consume ~55k tokens in definitions before Claude does any work.”
↩︎ Checkpoint“The API runs the search and returns the matching tools as tool_reference blocks”
↩︎ Checkpoint - 2.
“Tool definitions can consume large portions of the context window (50 tools can use 10-20K tokens), leaving less room for actual work.”
↩︎ What a monolithic toolset costs“Maximum tools: 10,000 tools in your catalog”
↩︎ What a monolithic toolset costs - 3.
“This trades a small amount of latency (one extra turn to look up a tool) for a large reduction in baseline context usage.”
↩︎ Choosing between progressive discovery and a fixed toolset“Add tool search once your toolset grows past roughly 20 tools or your baseline context usage becomes noticeable.”
↩︎ Choosing between progressive discovery and a fixed toolset“Enable prompt caching on your tool definitions from day one.”
↩︎ Choosing between progressive discovery and a fixed toolset“Prompt caching doesn't reduce the number of tokens in context, but it reduces what you pay for them on subsequent requests.”
↩︎ Exam trap 3“This is the right choice when the toolset is large but fixed.”
↩︎ Checkpoint