📰 Key Takeaways

Google has launched a preview of “Tool Retrieval” in the Gemini API’s Interactions API, aimed at a problem agents hit when connected to dozens or even hundreds of tools: sending the full parameter schema with every request pushes up input tokens, adds latency, and makes tool selection less accurate as the candidate list grows. The approach is to keep the full tool library on standby and only load a schema when the current task needs it.

To turn it on, you add the tool_search tool to your request and set defer_loading: true on the tools you want to load later. The model can still see the name and description of every deferred tool, so it knows what’s available, but the schemas don’t enter the context. When it needs a tool, the model asks for it by name, the API loads the full schema, and the model then issues the function call, all within a single request. The example uses an issue_refund function to handle “order A-1042 arrived damaged, refund $40.” The interaction.steps field records tool_search_call, tool_search_result, and function_call in order, which makes it easy to check which tools the model considered when you’re debugging. After that, it works like a normal function call: your code runs the refund and returns a function_result.

On top of that, the search runs server-side on Gemini, so you don’t have to build or host an index. Your code just adds the tool and flags the ones to defer. You can keep frequently used tools preloaded and defer only the long-tail ones. It also works with prefix caching: deferred schemas aren’t at the start of the prompt, and the schemas the model loads get appended later in the conversation, so the cached prefix stays the same across turns. Remote MCP servers are supported too. Set defer_loading: true on an mcp_server tool, and every tool that server provides gets loaded on demand.


💬 JudyAI Lab Take

Google has launched a preview of Tool Retrieval in the Gemini API. It lets an agent keep its full tool library on standby and only load a tool’s argument schema when it’s needed. Once you have dozens or even hundreds of tools, this is a very practical step.

The old approach was to send the full argument schema for every tool with every request. Input tokens go up, latency goes up, and tool selection gets less accurate as the candidate list grows. This design splits tools into two layers: the model first sees names and descriptions, so it knows what’s available, and the full schema only loads when it’s actually about to call something, all within one request. We think this points to a direction for agent design: context is a costly resource, and you shouldn’t just dump everything on the model. Another detail worth noting is that it works with prefix caching. Deferred schemas are appended later in the conversation, so the cached prefix doesn’t get broken. The search runs server-side on Gemini, so developers don’t need to build their own index, and frequently used tools stay preloaded while only the long-tail ones get deferred. The same approach also extends to remote MCP servers.

If your agent already has a lot of tools attached, start by sorting out which ones get used every time and which only occasionally. Then set the occasional ones to deferred loading and compare input token counts before and after.


📅 Source Info


🔗 Further Reading