Tool search for AI agents compared: how OpenAI, Anthropic and Google load tools on demand
OpenAI, Anthropic and Google now all let agents load tool schemas on demand. Here's how defer_loading and tool search work in each API, the limits, how caching behaves, and when deferring tools actually saves money.
Why does tool search matter for AI agents?
If your agent connects to a few MCP servers, its tool definitions can use up a large share of the context window before it does any work, and you pay for those tokens on every request. The Anthropic tool search tool docs give a concrete example: a setup with GitHub, Slack, Sentry, Grafana, and Splunk "can consume ~55k tokens in definitions before Claude does any work."
Accuracy also suffers, because Claude's ability to pick the right tool "degrades once you exceed 30‑50 available tools."
All three major model APIs now offer the same fix. You mark tools as deferred and add a tool search tool, and the model loads full schemas only when it needs them. On November 19, Google became the third to ship it, adding Tool Retrieval to the Gemini API (Google's Tool Retrieval announcement).
What to do now:
- Set
defer_loading: trueon rarely used tools and add your vendor's tool search tool. Keep your two or three most‑used tools loaded. - On Claude, put your cache breakpoint on a non‑deferred tool, or the API returns a 400 error.
- Log input tokens and tool‑selection accuracy before and after. The savings depend on your setup.
Here's how the three implementations compare.
How does deferred tool loading work?
The pattern is the same across all three vendors:
- Add a tool search tool to the request.
- Set
defer_loading: trueon the tools to hold back. Keep the tools you use most loaded up front. - The model still sees each deferred tool's name and description, so it knows what exists, but not its parameter schema.
- When it needs a tool, it searches, the API (or your code) returns the matching definitions, and the model calls the tool, usually within the same request.
How do OpenAI, Anthropic and Google compare?
How does tool search affect prompt caching and cost?
Deferred loading only saves money if it doesn't break prompt caching. All three vendors address this:
- OpenAI says tool search "is designed to preserve the model's cache". When new tools are discovered, "they are injected at the end of the context window."
- Google says deferred schemas "stay out of the start of the prompt, and the schemas the model loads are added later in the conversation, so the cached prefix stays the same from turn to turn."
- Anthropic has a sharp edge: a tool with
defer_loading: true"can't also carrycache_control", and the API returns a 400 error. Put your cache breakpoint on a non‑deferred tool.
On pricing, Google is the most explicit. Turning on tool_search "adds a small, fixed block of input tokens," and each loaded schema "is billed as input for the rest of the conversation." In other words, deferring saves you money only when the schemas you never load outweigh the search overhead plus the ones you do load. That's the usual case for big libraries and rarely true for agents with 10 tools.
Should you use hosted or client‑side tool search?
Use hosted search when you know the full tool inventory at request time. It's one flag and no infrastructure.
Use client‑side search when:
- tools depend on per‑user permissions, so the model should never even see the names of tools the user can't access,
- you already have a tool registry or embedding index, or
- tools appear mid‑conversation, such as when a user connects a new integration. Google notes client‑side tools "do not need to be declared upfront."
The cost is latency. Google notes client‑side retrieval "adds one round trip per search."
The Gemini tool retrieval docs list two more limits worth planning around. Tools the model loads "stay in context for the rest of the conversation and can't be unloaded," so a long session can drift back toward a large tool list. And a search that matches no deferred tool "produces a text response instead of a structured error," so your agent loop should handle a plain‑text miss rather than wait for an error code.
What are the practical rules for agent builders?
- Measure before and after. Log input tokens per task and tool‑selection accuracy on a fixed eval set. Every vendor frames savings as conditional. OpenAI's wording is that tool search "may help reduce overall token usage and cost."
- Write descriptions for search, not just for humans. With deferred tools, the name and description are all the model sees up front. On OpenAI, namespaces and MCP servers show only their own top‑level description, so make those specific.
- Keep the hot path loaded. The two or three tools used in most tasks shouldn't be deferred.
- Defer whole MCP servers. All three APIs let you defer a server's tools in one setting, which is the quickest win for agents connected to large servers such as the GitHub MCP server or Sentry's.
- Re‑test tool selection after switching. Search adds a step where the model can pick the wrong tool, so watch for "tool not found" retries.
What does this mean for builders?
Tool search makes it practical to give an agent hundreds or thousands of tools. Anthropic says in its Skills over MCP announcement that tool search "can cut the context they use by over 85% in multi‑server setups." The bottleneck shifts from context size to tool design. Clear names, specific descriptions, and sensible grouping now directly affect accuracy and cost. If you publish an MCP server, write your tool descriptions so a search can find them.
Find servers to connect in the OpenTools MCP directory, and follow platform changes from OpenAI, Anthropic and Google.
Related News
Dec 6, 2026
Which Claude model should you use? Fable 5.2 vs Opus 5.5 vs Sonnet 5.5 vs Haiku 5.5, with prices and cost per task
Claude Fable 5.2, Opus 5.5, Sonnet 5.5 and Haiku 5.5 compared on price, caching, default effort and benchmarks. Anthropic says to start with Opus 5.5, and its own numbers show why the priciest model can cost less per task.
Dec 6, 2026
ChatGPT Wallet for merchants: a checklist to stop blocking AI agents at checkout
ChatGPT Wallet lets agents pay on existing checkouts, and it now reaches eligible Plus and Pro users in the U.S. But bot defenses, fraud rules and login walls can block those sales. Here's a merchant checklist based on OpenAI's Commerce Partner Playbook.
Dec 6, 2026
Skills over MCP, Tasks and Elicitation: what MCP server builders should change now
Claude now supports Skills over MCP in public beta, and Tasks and Elicitation are generally available. Here's what each MCP extension does, who gets it, and what server builders should change, including the elicitation migration in the 2026-07-28 spec.