Direct answer
Deferred tool loading is an explicit Messages API pattern. Official documentation says deferred tools are discovered and loaded on demand instead of loading every definition into context initially (F070). The application still sends every tool definition; defer_loading controls context inclusion, not request-payload size (F071). At least one tool, typically the search tool, must remain non-deferred (F072).
Do not assume this happens automatically in Claude Code. Verify the model, API, and integration surface before implementing it. The practical benefit concerns definition context, while the cost includes explicit configuration and on-demand discovery. No token-saving figure or model threshold is established here.
Why tool definitions create a context problem
A tool definition tells the model what a tool does, which inputs it accepts, and how to interpret its use. A large catalog can therefore add substantial material before the task-specific evidence even begins.
The problem is relevance. A task may need a small subset of the catalog, yet the application can send definitions for tools the current task will never call. More definitions can make selection harder and consume context that could hold source evidence or task constraints.
The tool schema guide explains how clear names, descriptions, and required inputs support selection. Better definitions remain valuable. The pattern addresses a different question: which definitions enter model context at the start?
The context relevance guide provides the shared principle. Material earns a place by changing the decision. A tool definition that cannot be relevant to the current task is a candidate for later discovery rather than initial loading.
There is a cost boundary. The prompt caching economics guide and long-context latency discussion describe related cost dimensions. Neither establishes a fixed saving from deferring a given definition, so this article does not convert the pattern into a price or speed promise.
The pattern also does not solve every context problem. Conversation history, stale files, and oversized results can still crowd the session. The context audit guide remains useful for inspecting what is actually present.
What the official evidence establishes
Official (F070). The tool-search documentation says deferred tools are discovered and loaded on demand instead of loading all definitions initially. This is an explicit Messages API configuration, not an automatic Claude Code feature.
Official (F071). The same documentation says applications still send every tool definition while defer_loading controls context inclusion. Those definitions remain in the request payload.
Official (F072). The documentation requires at least one tool, typically the search tool, to remain non-deferred. The requirement applies to the documented API implementation.
Official (F073). The tool-use overview says client tools require an input_schema. That API requirement does not mean every Claude Code tool is user-defined.
Official (F075). The tool-search documentation shows that tool definitions are the material discovered when a deferred tool is loaded. Clear definitions support selection but do not guarantee the right call.
The define-tools page and handle-tool-calls page are canonical-link-only in this batch. No detailed mechanics are inferred from them. Claude Code best practices is further reading, not evidence of automatic deferred loading in the interactive product.
Define the tool-definition context problem
Start by inventorying the catalog. Which definitions are broadly useful? Which belong to a narrow workflow? Which are rare, destructive, or irrelevant to most tasks? The inventory should describe purpose, not only tool names.
A useful catalog note separates always-needed discovery from task-specific capabilities. The search tool may need to remain available so the model can find other definitions. Domain tools can be candidates for deferred loading when the documented integration supports the pattern.
Do not assume that the largest definition is the least useful. A complex tool may be central to the task, while a short definition may be irrelevant. Size helps estimate context cost; purpose determines initial availability.
The progressive disclosure guide applies a related idea to instructions. Narrow rules belong near relevant paths or workflows. On-demand definitions apply the same relevance instinct to a tool catalog, but through a different documented mechanism.
The file reference guide helps keep task evidence focused. Protecting some context space does not justify attaching unrelated files.
A catalog review should also expose duplicates. Two tools with overlapping descriptions can make selection harder even when one is deferred. The tool schema guide helps clarify intent before any loading strategy is applied.
Explain defer_loading
defer_loading is the documented control for context inclusion. Official (F071). The application still sends every tool definition while the control determines whether a definition is included in model context initially.
That distinction prevents a common mistake. Deferred does not mean omitted from the request. It means available to the application’s request while withheld from initial model context under the documented pattern.
A simple mental model has two layers:
- Request layer: The application sends the complete set of tool definitions.
- Context layer: The model initially receives the non-deferred definitions and discovers deferred definitions on demand.
The model is an editorial explanation of F070 and F071, not a claim about internal transport details beyond the documentation. It exists to stop “deferred” from being mistaken for “not sent.”
For a direct API integration, configuration must be explicit. The fact pack does not provide a universal snippet that applies to every client or model. Verify the current official documentation and the integration’s supported fields before writing production code.
The tool choice investigation guide reinforces the execution-surface boundary for another API control. Documented API behavior should not be copied into an interactive Claude Code how-to without support evidence.
Explain on-demand discovery
On-demand discovery means the model can locate and load a deferred definition when the task needs it. Official (F070). Deferred tools are discovered and loaded on demand instead of loading all definitions initially.
Discovery depends on an available route to the definitions. Official (F072). At least one tool, typically the search tool, must remain non-deferred in the documented implementation. A catalog with every tool deferred would remove the initial discovery path required by that pattern.
A good discovery experience depends on clear definitions. Official (F075). Tool definitions are the material discovered when a deferred tool is loaded. Vague names or overlapping descriptions can make the loaded definition less useful even when the mechanism works.
The tool schema guide covers the input side of clarity. The tool result contract guide covers the output side. Deferred discovery does not repair an ambiguous schema or an opaque result.
On-demand loading also adds a decision point. The model must recognize that a capability is needed and discover the relevant definition. If the description does not match the task language, the tool may remain undiscovered. That is a practical loss to test, not a measured failure rate.
The investigation-before-answer guide can help request evidence gathering in an interactive task. It does not establish deferred discovery support in Claude Code.
Keep at least one tool available
Official (F072). The documented API implementation requires at least one non-deferred tool, typically the search tool. Treat that as a design constraint for the documented pattern, not as a universal rule for every agent harness.
Choose the initially available capability deliberately. Its purpose is to let the model reach the deferred catalog. If its description is unclear or its inputs are awkward, discovery can fail before any domain tool is considered.
A catalog plan can be simple:
| Tool group | Initial status in the documented pattern | Reason | Review question |
|---|---|---|---|
| Search or discovery tool | Non-deferred | Provides the route to other definitions | Can the model find the needed capability? |
| Broadly required task tool | Candidate for non-deferred | Needed across most work | Is it truly broad or merely familiar? |
| Narrow domain tool | Candidate for deferred | Relevant only in specific workflows | Will its description match the task? |
| Rare administrative tool | Candidate for deferred | Unrelated to most tasks | Does deferral reduce accidental selection? |
| Duplicate or overlapping tool | Redesign before loading | Ambiguity harms any strategy | Can one definition own the purpose? |
The table is an editorial planning aid. It does not prescribe a universal catalog layout or claim that every Claude Code integration exposes these controls.
A non-deferred tool still needs a useful result contract. The tool result evidence guide explains why discovery output should identify the relevant definition rather than return an opaque success.
The parallel tool call guide is relevant when discovery and another read are proposed together. A call that needs a discovered definition is dependent on discovery, even if the later operation is read-only.
Check model and API requirements
The fact pack establishes the pattern but does not provide a verified list of supported models, client versions, or thresholds. Do not invent them. Check the current official tool-search documentation and the specific integration before implementation.
A support check should answer:
- Does the API surface expose the documented deferred-loading configuration?
- Does the chosen model support the documented pattern?
- Does the client send every definition as required by F071?
- Is a non-deferred discovery tool configured as required by F072?
- Can the integration observe which definition was loaded?
- Does the result contract expose enough evidence to verify discovery?
The OpenAI and Anthropic API compatibility resource can help with message-format boundaries in a separate gateway integration. Format compatibility alone does not prove support for every tool feature.
The structured-output agent brief guide discusses another capability whose availability depends on the execution surface. Deferred loading deserves the same caution.
The commands reference is not part of this post’s verified source set, and the fact pack provides no interactive command for deferred loading. Do not guess a slash command or settings field.
When support is unknown, record the gap. A smaller initial context is not worth an unsupported configuration that the integration silently ignores or rejects.
Separate payload from loaded context
The most important distinction in F071 is between what the application sends and what enters model context. A request can contain every definition while only a subset is initially loaded into context.
Use separate measures in a design note:
| Measure | What it counts | Effect of deferral | What not to claim |
|---|---|---|---|
| Request payload | Definitions and other data sent by the application | Every definition is still sent (F071) | A smaller payload |
| Initially loaded definitions | Definitions included in context at the start | Deferred definitions wait (F070) | A fixed token saving |
| Discovered definitions | Definitions loaded on demand | Relevant definitions become available | Guaranteed correct selection |
| Tool results | Evidence returned after calls | Unchanged as a category | Automatic relevance or completeness |
The token and context glossary can help keep these terms precise. The glossary does not supply a model-specific threshold or a savings estimate.
A useful review records both sides. If a team reports only the initially loaded count, it may accidentally imply that the request became smaller. If it reports only the payload count, it may miss the context benefit.
The context audit guide can help inspect session composition in Claude Code. It does not prove that a direct API request used deferred loading. Keep the integration evidence separate from the interactive view.
The cost per verified change framework supports evaluating the whole workflow. Configuration effort, discovery failures, and correction work belong beside any context benefit.
Check whether the Claude Code integration supports the pattern
The title names Claude Code, but the verified mechanism comes from Messages API documentation. That makes the support check essential. F070 explicitly says deferred loading is not an automatic Claude Code feature.
Begin with the actual integration. Is the work happening in interactive Claude Code, an Agent SDK application, or a direct API client? Which layer constructs the tool definitions? Which layer can set the documented configuration?
The plan dependency guide can help record the support check before implementation. A missing support fact is a blocking unknown, not a reason to write a speculative tutorial.
| Surface | Verified fact from this batch | Reasonable action |
|---|---|---|
| Direct Messages API integration | Explicit deferred-loading pattern exists (F070-F072) | Verify current model and client support |
| Agent SDK application | No specific deferred-loading support fact in this pack | Inspect its own documentation and request construction |
| Interactive Claude Code | Automatic deferred loading is not established | Do not present API fields as interactive settings |
| Custom gateway integration | Message compatibility is not feature parity | Verify the exact upstream and client behavior |
The tool choice investigation guide applies the same surface check to tool_choice. The parallel tool call guide applies it to scheduling. Each API mechanism needs its own support evidence.
A negative support result is useful. It tells the team to keep the full catalog initially loaded, narrow the catalog, or choose a different integration. It does not justify pretending that the feature exists.
Avoid unsupported feature claims
Use language that names the surface and the evidence. “The Messages API documentation describes deferred loading” is supportable. “Claude Code automatically hides unused tools” is not supported by this fact pack.
Avoid invented model names, version numbers, token thresholds, or savings percentages. The research register intentionally omitted numeric examples from the tool-search source because they were not needed for this topic.
The context-window versus memory article covers a different problem. No memory-behavior change is established here, and a smaller initial definition set does not prove better recall.
The monorepo search guide covers repository search rather than tool discovery. Keep the mechanisms separate even when both involve finding relevant material.
A support claim should be reviewable. Record the documentation page, the integration, and the observed configuration. If the behavior was only inferred from a smaller context display, mark it unconfirmed until the request construction is verified.
The security harness analysis remains relevant because discovery does not grant permission or make a tool trustworthy. Loading a definition on demand changes availability in context, not the tool’s authority.
Worked example: a catalog with one discovery tool
Consider a fictional integration with twelve tool definitions. One is a search tool that remains non-deferred. The other eleven are marked deferred under the documented pattern.
The derived counts are:
Total definitions sent = 12
Deferred definitions = 11
Initially non-deferred definitions = 12 - 11 = 1
Definitions still sent in the request = 1 + 11 = 12
These are illustrative counts, not a benchmark or a recommended catalog size. The formula demonstrates the payload distinction in F071. It does not estimate tokens, cost, latency, or selection accuracy.
At the start, the search tool is available in context. When the task needs a narrow capability, discovery identifies the relevant definition and that definition is loaded on demand. The application’s request still contains all twelve definitions.
Suppose discovery returns an ambiguous match between two tools. The next step is not to load both and hope for the best. Inspect the definitions, clarify their purposes, and improve the catalog. The tool schema guide supports that repair.
Suppose the needed tool remains undiscovered. The loss is concrete: the task may proceed without a capability that exists in the catalog. A clear search description and focused task language can help, but F075 does not guarantee correct selection.
Suppose the integration cannot expose the configuration. The correct action is to stop the deferred-loading implementation and record the support gap. Sending a field that the client ignores would create a false explanation for any observed context change.
The tool result contract guide helps make the discovery result inspectable. A useful result identifies the definition found, its purpose, and any ambiguity rather than reporting only success.
Practical adoption matrix
Use this matrix before changing a production tool catalog.
| Question | Ready to proceed | Stop or investigate |
|---|---|---|
| Surface | Documented API support is verified | Support is inferred from another product |
| Configuration | Client exposes the required control | Field availability is unknown |
| Payload | Application sends every definition (F071) | Team expects deferred definitions to disappear |
| Discovery | At least one non-deferred tool exists (F072) | Every tool is deferred |
| Definitions | Names and purposes are distinct | Overlapping descriptions obscure selection |
| Results | Discovery returns identifiable evidence | Output is an opaque success |
| Measurement | Payload and context are recorded separately | Only one count is reported |
| Claims | Limits and gaps are explicit | Savings or model support is guessed |
The model choice resource for coding agents can help evaluate capability, but it does not verify deferred-loading support. The migration guide may help with a separate gateway move, not with this API feature.
The context audit guide remains useful after adoption. Inspect whether the expected definitions and task evidence are present, while keeping the API configuration evidence separate.
Win, loss, and practical implication
Concrete win. In the fictional catalog, only the discovery definition is initially loaded while the application still sends all twelve definitions. A narrow task can reach a relevant definition without placing every domain definition into context at the start.
Concrete loss. A needed tool can remain undiscovered when its description does not match the task, and the request payload does not shrink. The pattern also requires explicit integration work and a non-deferred discovery route. Those costs remain even when initial definition context is reduced.
Practical implication. Treat deferred loading as an API integration decision with a support check, a catalog review, and separate payload and context measurements. Do not present it as an automatic Claude Code feature or a guaranteed optimization.
Data gaps and future updates
The fact pack does not verify automatic deferred loading in Claude Code, a supported-model list, a client-version threshold, or a token-saving benchmark. Those gaps should remain explicit until a primary source or reproducible integration test establishes them.
The define-tools and handle-tool-calls pages were canonical-link-only. A future update should recheck their current details before adding field-level instructions. Any performance claim should report the catalog, task, model, integration, and measurement method.
Community reports: None are cited. No reproducible community run is present, so no anecdote is used to fill the support or savings gap.
One AI API Key option for OpenAI-format agents
For a separate OpenAI-format agent, One AI API Key offers one key at https://api.oneaiapikey.com/v1 and 46 live free IDs in the checked batch record. Its Claude IDs were unavailable on 2026-11-27, so those free IDs must not be presented as a Claude Code model source. Review the free model listing for the OpenAI-format option and the cost calculator when comparing a custom API integration.
FAQ
Does deferred loading make the request payload smaller?
No. F071 says the application still sends every tool definition. defer_loading controls context inclusion, not whether the definition is sent.
Is deferred loading automatic in Claude Code?
Not on the available evidence. F070 describes an explicit Messages API configuration and explicitly rejects treating it as an automatic Claude Code feature.
Why must one tool remain non-deferred?
F072 says the documented implementation requires at least one non-deferred tool, typically the search tool. That tool provides the initial route for discovering deferred definitions.
How many tokens does deferred loading save?
The fact pack provides no verified saving for this topic. Measure payload and loaded context separately under stated conditions instead of inventing a percentage or threshold.
More Claude Code troubleshooting
- Claude Code Requirements: Turn Vague Goals into Observable Outcomes
- Claude Code Prompt Structure: Separate Goals, Rules and Examples
- Claude Code Negative Requirements: Define What Must Stay Unchanged
- Claude Code Acceptance Examples: Show Inputs and Observable Results
- Claude Code Ambiguous Requirements: Clarify Before Choosing
- Claude Code Prompt Specificity: Name Files, Symbols and Exceptions
- Claude Code Plan Mode: Approve Direction Before Files Change
- Claude Code Exploration Plans: Resolve Unknowns Before Implementation
- Claude Code Task Breakdown: Give Each Step an Exit Condition
- Claude Code Plan Revision: Replan When Evidence Changes Assumptions
- Claude Code Reversible Planning: Sequence Small Changes First
- Claude Code CLAUDE.md: Keep Only Instructions Every Task Needs
- Claude Code Conflicting Instructions: Write a Clear Precedence Rule
- Claude Code Image Prompts: Pair Visual Evidence With Written Constraints
- Claude Code Task Checkpoints: Make Long Work Inspectable
- Claude Code Edit Targets: Name the Exact Block to Replace
- Claude Code Style-Preserving Edits: Follow Local Patterns First
- Claude Code Refactoring Scope: Change Structure, Preserve the Contract
- Claude Code Stop Conditions: End at the Agreed Boundary
Sources
- Official, fetched: Tool search tool, source for F070, F071, F072, and F075.
- Official, fetched: Tool use with Claude, source for the
input_schemafact F073. - Official, canonical link only: Define tools, further reading without detailed mechanics asserted.
- Official, canonical link only: Handle tool calls, further reading without detailed mechanics asserted.
- Official, fetched: Claude Code best practices, further reading only; it is not used as evidence of automatic deferred loading.