Gemini Tool Retrieval cuts agent tool-schema token cost

Google launched Tool Retrieval in preview for the Gemini API on November 19, 2026, and the problem it solves is one every agent builder hits quickly: a large tool library turns every request into a bill. Google docs put it plainly — a few dozen function declarations can consume tens of thousands of tokens on every request, and tool selection accuracy drops as the candidate list grows. Tool Retrieval lets an agent keep hundreds of tools on standby, see only a short name and description for each, and pull the full parameter schema into context only when the current task actually needs it.
- Preview, Interactions API, v1beta only — Tool Retrieval is in preview and requires the v1beta API version of the Gemini Interactions API; the generateContent method does not support it.
- Deferred tools cost roughly 26 tokens each — Google's developer guide says the model sees only a one-line summary per deferred tool, about 26 tokens, or smaller when a short_description is supplied.
- No separate charge, but a search is not free — Tool Retrieval has no separate charge and uses standard input, cached and output rates, but each server-side search triggers an extra model call inside the request and its tokens are billed at the input rate.
- Below 20 tools, static loading is usually cheaper — Google's guidance is to use static loading when an agent has fewer than 20 stable tools, and to keep the 3 to 5 most frequently used tools loaded while deferring the long tail.
How the single-request round trip works
Related guide: Claude Duet: Anthropic's proactive agent that messages you first
The server-side flow produces three step types in interaction.steps. A tool_search_call records which tools the model asked for, a tool_search_result carries the loaded schemas, and then a function_call is the step your code actually executes. Because the API resolves the first two inside the same request, your application only has to run the function call and send back a function_result.
That single-request property is what keeps latency and caching intact. Google notes that retrieved schemas append inline later in the conversation rather than mutating the prompt prefix, so the cached prefix stays the same from turn to turn. Deferred tools are not billed for their schemas until they are loaded — a deferred tool contributes only its name and short description to the input token count.
Remote MCP servers are the real payoff
Related guide: Businesses in ChatGPT: Business Hub and Business Agents
The most useful application of this is not a hand-written function list. Set defer_loading: true on an mcp_server entry and every tool that server exposes is loaded on demand, so you can connect a large MCP server without enumerating its tools one by one. When the model retrieves and calls a deferred MCP tool, the API executes it on the remote server and returns mcp_server_tool_call and mcp_server_tool_result steps in the same response.
This directly addresses a problem that most MCP adopters hit: a server with a hundred tools makes every other request pay for all hundred schemas. If you have been trimming MCP servers by hand to keep prompts affordable, deferring the whole server is the cleaner answer — and our guide to MCP connectors and agent tool-calling patterns covers how to structure those servers.
What it costs, and when it backfires
Related guide: Snowflake Business Ontology and Cortex AI Gateway Guide
There is no separate line item. Input, cached and output tokens are billed at the standard rates for the model you call. But "no separate charge" is not "no extra cost": each server-side search triggers an extra model call inside the request with the full context plus the loaded schemas, and those prompt tokens are reported in total_tool_use_tokens and billed at the input rate. Loaded tools also stay in context for the rest of the conversation and cannot be unloaded.
Google's own threshold is the most useful rule of thumb available: use static loading when you have fewer than 20 stable tools, because below that the search pass costs more than the schemas it avoids. Their recommended configuration is to keep the 3 to 5 most frequent tools loaded and defer the long tail. The same guidance applies to very long contexts where a search runs every turn, and to cases where the unloaded schemas outweigh the loaded ones — which is not the usual case for large libraries but can be true for small ones.
Deferring also shrinks your prompt, which can drop a medium-sized prompt below the model's minimum cacheable size and quietly lose the caching benefit you had. That is a subtle cost, and it is worth checking your cache hit rate after enabling the feature rather than assuming the win carries over.
Implementation details that cause 400 errors
Related guide: Gemini 4 Neon: Benchmarks, Pricing & Antigravity Guide
The docs are unusually explicit about failure modes, and three of them will bite on the first attempt.
First, defer_loading: true requires a server-side tool_search in the same request. Setting defer_loading without one returns a 400. Second, server-side and client-side retrieval cannot be combined in the same request, and defer_loading applies to server-side retrieval only. Third, the API does not persist tool declarations between turns — you must send the full tools array on every request, including follow-up turns that carry a function_result, even when you chain turns with previous_interaction_id.
The stateless path is stricter still. If you manage conversation history yourself with store=false, you must append every model-generated step from the response unchanged, keeping both tool_search_call and tool_search_result in their original order before the function_call, and preserving the signature field on each of those steps. Omitting the search steps, or stripping a signature, returns a 400 when you send back the function_result. Omitting tool_search_result alone does not error, but it drops the loaded schemas from context — which looks like a model suddenly forgetting how to call the tool.
One more behavioural rule is worth internalising: do not defer a tool whose name appears in your system instructions or in another tool's output, because the model may call it without searching for it first, which the API treats as an error.
Client-side retrieval when you own the registry
Related guide: Google's Gemini Model Gate: What Free and AI Plus Users Lose From October 9
If your tools live in your own registry with per-user permissions or an embedding index, declare tool_search with execution: "client", give it a name, a description and optional parameters, and let your application do the lookup. The model calls your search tool, you return matching function declarations in function_result, and the model calls the discovered tool on the next turn. The cost is one extra round trip per search, because your application runs the lookup.
Google's developer guide shows the interesting version of this: routing the candidate tools through the Gemini Decisions API, which scores tools in parallel with calibrated probabilities at zero output tokens, then returning only the matches above a threshold. That is a different pattern from embedding search — it uses a scoring model to decide relevance rather than a vector index. If you are building this kind of router yourself, our coverage of head-to-head AI comparisons is a reasonable place to check how routing and retrieval models line up against simpler baselines.
Is it worth enabling now?
Related guide: Gemini 4 Hydrogen: Google's faster agent model explained
If your agent has fewer than about 20 tools, probably not — static loading is simpler and avoids the search pass. If your agent is wired to a large MCP server, or you are paying to re-ship hundreds of schemas every turn, it is worth a bounded test this week. Measure two things on your own traffic rather than trusting a generic claim: the input tokens per request before and after, and whether tool selection accuracy holds when the candidate list is longer than the ones in the docs.
Two caveats to keep in mind. It is a preview on a v1beta surface, so the API shape can change before general availability. And the supported-model list is specific: Gemini 4 Carbon, Neon, Hydrogen and Argon, plus Gemini 3.8 Flash and 3.6 Flash. Calling it on an unsupported model returns a 400 with the message deferred loading is not supported for this model.
Frequently asked questions
Preview, Interactions API, v1beta only
Tool Retrieval is in preview and requires the v1beta API version of the Gemini Interactions API; the generateContent method does not support it.
Deferred tools cost roughly 26 tokens each
Google's developer guide says the model sees only a one-line summary per deferred tool, about 26 tokens, or smaller when a short_description is supplied.
No separate charge, but a search is not free
Tool Retrieval has no separate charge and uses standard input, cached and output rates, but each server-side search triggers an extra model call inside the request and its tokens are billed at the input rate.
Below 20 tools, static loading is usually cheaper
Google's guidance is to use static loading when an agent has fewer than 20 stable tools, and to keep the 3 to 5 most frequently used tools loaded while deferring the long tail.
Prices and benchmark figures are standard published rates as of November 23, 2026 and can change without notice. Some outbound links may be affiliate links — see our disclosure. Found an error? Tell us and we'll correct it in public.