Gemini API tool retrieval enters preview: deferred tools bill by name only, and each search is an extra model call
Tool retrieval for Gemini 4 and two Flash models is v1beta and Interactions-only, and Google's own docs say static loading can still be cheaper for small tool sets.
Google's Gemini API changelog for November 19 lists "Tool retrieval (Preview)" for the Interactions API. An agent can now declare its whole tool library once, mark most of it as deferred, and let the model pull in parameter schemas only when it decides it needs them. Google's documentation states the problem it is solving: "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."
The request shape
Two additions to the tools array turn it on: a tool_search entry, and defer_loading on each tool to hold back.
"tools": [
{"type": "tool_search"},
{
"type": "function",
"name": "convert_currency",
"description": "Convert an amount from one currency to another.",
"defer_loading": true,
"parameters": { ... }
}
]
The model sees each deferred tool's name and description. When it wants one, the response carries tool_search_call and tool_search_result steps ahead of the usual function_call, and the docs say the API "resolves tool_search_call and tool_search_result inside the same request, so you only execute the function_call step." Setting defer_loading on an mcp_server entry defers every tool that server exposes.
A second mode, execution: "client", hands the search to your application instead: the model calls a search function you define, and you return function declarations as the result. That costs one extra round trip per search, and lets you inject tools that were never in the original array.
What you pay for
There is no separate fee, but the accounting has three parts, all from the pricing section of the docs:
- Deferred tools add only their name and
short_description"(or the first sentence ofdescription)" to input tokens. "Parameter schemas are not billed until loaded." - "Each server-side search triggers an extra model call inside the request with the full context plus loaded schemas." Those tokens appear in
total_tool_use_tokensand bill at the input rate. - Loaded schemas are appended to the conversation, not inserted into the prefix, so implicit caching keeps working. But a smaller prompt "can drop a medium prompt below that minimum size" for caching at all.
Google does not claim it always wins: "With small libraries or very long contexts that search on every turn, static loading can cost less." Its comparison table puts the static-loading sweet spot at "Fewer than 20 stable tools."
The traps in the docs
Several behaviors will catch a client that treats this as a drop-in flag.
The tools array is not remembered. Even with server-side conversation state, "The API doesn't persist tool declarations across turns." Leave tool_search off a follow-up request and you get an error: tool_search tool must be specified when using defer_loading.
Stateless clients must replay steps untouched. Each retrieval step carries an encrypted signature. Per the docs, "Omitting tool_search_call or stripping signature from any step returns a 400 error." The quieter failure is the other one: "Omitting tool_search_result doesn't return an error, but drops the loaded schemas from context."
Do not defer a tool you mention by name. If a system instruction names a deferred tool, "the model may call them without searching first," which fails.
status is not a reliable signal. The docs tell you to inspect the steps on every response "because status isn't always requires_action when a function_call is returned."
Nothing unloads. "Loaded tools stay in context for the rest of the conversation and can't be unloaded." And a search that finds nothing "produces a text response instead of a structured error."
Where it runs
Tool retrieval requires the v1beta API version and the Interactions API. From the limitations list: "generateContent doesn't support tool retrieval." Supported models are gemini-4-carbon, gemini-4-neon, gemini-4-hydrogen, gemini-4-argon, gemini-3.8-flash and gemini-3.6-flash. It is a preview, and the page carries the usual warning: "The API surface may change before general availability."
Primary sources: Gemini API changelog, Tool retrieval documentation, read 2026-11-23.