Google Previews On-Demand Tool Retrieval for Gemini API Agents – Unite.AI

0
1



Google announced Tool Retrieval on November 19, 2026, making the feature available in preview in the Gemini Interactions API. It lets agents keep large tool libraries on standby and load full parameter schemas only when the current task requires them.

Google says the conventional approach becomes unwieldy as agents connect to dozens or hundreds of tools: sending every full schema inflates input-token counts, adds latency and reduces tool-selection accuracy as the candidate list grows. Tool Retrieval initially keeps only each deferred tool’s name and description in context, withholding the schema that defines the function’s arguments until the model asks for it.

The Interactions API became generally available in June 2026 and is Google’s recommended interface for new projects. Tool Retrieval works exclusively through that interface; the older generateContent method does not support it.

Server-Side and Client-Side Retrieval

In the default server-side mode, developers add a tool_search tool and set defer_loading: true on selected function tools. Frequently used functions can remain fully loaded, while specialized ones initially contribute only their names and descriptions. When the model needs a deferred tool, one API call can contain a tool_search_call, a tool_search_result carrying the full schema and the resulting function_call, leaving those execution steps visible for debugging. For a custom function, the developer’s code still executes it and returns a function_result.

There is no retrieval index for developers to build or host; Gemini performs the server-side search. Setting defer_loading on a remote MCP server defers every tool that server exposes, so a large server does not require each tool to be listed individually. Retrieved schemas are inserted where they are loaded rather than at the start of the prompt, leaving the earlier prefix intact for implicit caching.

Client-side retrieval transfers search, ranking and filtering to the developer’s application. It adds one round trip per search but allows tools to be introduced mid-conversation without being declared upfront, such as when a user connects a new integration. Server-side and client-side retrieval cannot be combined within a request, and exactly one tool_search definition is allowed.

Token Costs and Model Support

Tool Retrieval has no separate charge, though it changes how tokens are billed rather than eliminating tool overhead. Server-side search instructions add a small, fixed input block to each request; the setup guide reports that early testing produced about 26 tokens per deferred tool for its compact name-and-description entry. Every schema the model loads remains billable as input on later calls and turns. Each server-side search also launches another model call with the full context and newly loaded schemas, with that prompt reported as tool-use tokens and charged at the input rate.

The guide’s explicitly illustrative two-request example uses round numbers and excludes output tokens and caching. With 200 tools of 400 tokens each and two tools loaded, it puts static loading at 164,000 input tokens, compared with about 23,650 input and tool-use tokens using retrieval. A second scenario with 10 tools of the same size and a 30,000-token context totals 68,000 tokens statically and about 92,830 with retrieval. That second case shows how repeating a large context for search can outweigh the savings from a small tool library.

The guide explicitly lists Gemini 4 Argon, Gemini 3.8 Flash and Gemini 3.6 Flash as supported models. Requests that set defer_loading on an unsupported model return a 400 error. It also cautions that the preview API surface may change before general availability.

Operational constraints remain important across supported models. Retrieved tools cannot be unloaded during a conversation. The complete tools array must also be resent on every request, including turns chained with previous_interaction_id, because tool declarations are not stored between requests.

Google’s broader function-calling guide recommends considering retrieval once a library passes roughly 20 to 30 tools. The launch consequently gives agents a way to keep much larger catalogs on standby, while making search frequency and retained schemas decisive to whether the extra capability reduces or increases token use.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here