Gemini API Tool Retrieval graphic showing an AI agent connected to a network of tools

Gemini API Tool Retrieval Lets Your Agent Load Only the Tools It Needs

If your AI agent juggles dozens of tools, Gemini API Tool Retrieval is Google’s new way to stop paying for tool definitions the model never uses. Instead of sending every full schema with every request, you hold most of them back and let Gemini ask for the ones it actually needs.

Google announced the preview on November 19, 2026, in its official developer blog post. It lives in the Interactions API, not the older generate-content path.

Here are the facts worth knowing before you read on:

  • Status: preview, in the Gemini Interactions API
  • Models: Gemini 3.6 and later, including every Gemini 4 model
  • Cost: no separate fee, just standard input and output token rates
  • Setup: add a tool_search tool and flag the rest with defer_loading
  • MCP: you can defer an entire MCP server in one flag

That’s the whole feature in five lines. The rest of this post covers how it behaves and where it can bite you.

Why big tool libraries get expensive fast

Every function you give a model comes with a name, a description and a parameter schema. Send fifty of those with every turn and you pay for fifty schemas, even when the user only asked about the weather.

It also hurts accuracy. A model staring at a long menu of similar tools is more likely to pick the wrong one. Google says Tool Retrieval is built to “reduce input tokens and keep tool selection accurate as your agent scales.”

If you’ve been watching what agents cost in practice, our look at the coding agent harness cost benchmark shows how quickly setup choices add up.

How tool_search and defer_loading work

You add a tool_search tool to the request. Then you set defer_loading: true on any tool you want to keep out of the starting prompt.

The model still sees each deferred tool’s name and description. It just doesn’t see the parameter schema. When it decides it needs a tool, it asks for it by name, the API loads the schema, and the model makes the call, all inside a single request.

The search runs on Google’s servers, so there’s no index to build or host. You can also leave your most-used tools undeferred and defer only the long tail.

For debugging, the steps show up in interaction.steps as tool_search_call, tool_search_result and function_call. That’s handy when you want to see why the model loaded a particular tool.

Server-side vs client-side retrieval

Google offers two modes. The default is server-side, and the other one hands the lookup to your own code.

Feature Server-side (default) Client-side
Who runs the search Gemini Your app
Setup Flag tools with defer_loading Set "execution": "client" and define search parameters
Extra round trips None, it’s one request One per search
Best for Fixed tool sets you can declare upfront Your own registry, embeddings or per-user permissions

Client-side mode is the interesting one for teams with a private tool registry. Tools don’t have to be declared upfront, so you can expose new ones mid-conversation, and your code can filter results by who’s asking.

What it costs, and what Google doesn’t promise

There’s no extra charge. You pay normal token rates, plus a small fixed block of input tokens for turning tool_search on.

Here’s the catch. Any schema the model loads is billed as input for the rest of that conversation, exactly like a tool you declared upfront. Savings only show up when the schemas left unloaded outweigh the ones that got loaded.

Google calls that the usual case for large libraries, but it gives no benchmark percentages. Treat any savings number you hear as unproven until you measure your own traffic.

One upside worth noting: deferred schemas stay out of the start of the prompt, so prefix caching keeps working across turns. If you’re comparing model costs generally, our breakdown of Gemini 4 Neon pricing is a useful companion.

Should you turn it on?

It depends on how many tools you carry and how often a typical conversation touches them. Three situations stand out.

  • You have dozens of tools and most chats use two or three: this is the sweet spot.
  • You connect large MCP servers: deferring the whole server in one flag is the easiest win.
  • You have fewer than ten tools: the fixed overhead may cancel out any savings.

The point is simple. Tool Retrieval pays off when the unused pile is big, and it’s a wash when it isn’t.

Frequently Asked Questions

Is Gemini API Tool Retrieval free?

There’s no separate fee. You pay standard token rates for the model you use, plus a small fixed block of input tokens when tool_search is enabled.

Which Gemini models support it?

Gemini 3.6 and later, including all Gemini 4 models, in the Interactions API. Google’s example code uses gemini-4-hydrogen.

Does it work with MCP servers?

Yes. Set defer_loading: true on an mcp_server tool and Gemini loads that server’s tools only when it needs them.

Is it production-ready?

Not yet. It’s in preview, and Google hasn’t said what might change before general availability.

My take

If you run an agent with a big tool belt, test this on a copy of real traffic this week. Log token use with and without tool_search, and only then roll it out. Skip it if your toolset is small, because the savings you’re chasing probably aren’t there.


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *