Latest News

Google's Tool Retrieval Moves Tool Selection Into the Gemini API — and Into Your Token Bill

Rushil ShahRushil Shah
8 min read
Share

Google shipped lazy tool-schema loading into the Gemini Interactions API. For teams hand-rolling tool filtering across multiple MCP servers, that's a structural change — but the token math only works if your prefix cache was already failing.

TL;DR

Google has put Tool Retrieval into preview in the Gemini Interactions API: add a tool_search tool, set defer_loading: true on the long tail, and the model sees only names and descriptions until it asks for a schema by name. Server-side search, schema load and function call all resolve inside one request. There's no separate fee — but the search is an extra model call billed at the input rate, which means a well-cached static tool list can still beat it. This is a real answer to tool-count scaling, and a trap for anyone who adopts it without measuring.

What actually shipped

On November 19, Google announced Tool Retrieval, authored by Gemini API product manager Lucia Loher and DeepMind research scientist Nora Kassner, with follow-up coverage from MarkTechPost. The mechanics are small enough to fit in a paragraph, which is the point.

You add one new entry to your tools array — {"type": "tool_search"} — and flag individual functions with defer_loading: true. Deferred tools still contribute their name and description to context so the model knows they exist; what disappears is the parameter schema, which is where the token weight lives. When the model decides it needs issue_refund, it emits a tool_search_call, the API returns a tool_search_result carrying the full schema, and the model emits the function_call — all three visible in interaction.steps for debugging.

python
tools = [
    {"type": "tool_search"},
    {
        "type": "function",
        "name": "issue_refund",
        "description": "Refund an order to the original payment method.",
        "defer_loading": True,
        "parameters": {...},
    },
    # ... 50+ other deferred functions (leave frequent tools undeferred)
]

The MCP integration is the part that matters most for integration teams: setting defer_loading: true on an mcp_server entry defers every tool that server exposes. You connect a large server without enumerating its surface. And critically, retrieved schemas are inserted where they're loaded rather than at the top of the prompt, so the cached prefix survives from turn to turn.

There's no index to build or host.

— Lucia Loher & Nora Kassner, Gemini API and Google DeepMind, Google blog

Why tool count was the ceiling

Anyone who has wired three or four MCP servers into a single agent knows the failure mode. It isn't a hard limit — it's a slow degradation. Every server you add inflates the system prompt, and somewhere past a few dozen tools the model starts picking plausible-but-wrong functions. Anthropic's documentation is the most candid published account of where that cliff sits.

30–50tools loaded before selection accuracy begins degrading, per Anthropic's tool search guidanceSource: Data Studios, 2026
~26tokens per deferred tool for its name-and-description entry in Google's early testingSource: Unite.AI, 2026
164k → 24kinput tokens in Google's illustrative 200-tool example, static vs. retrievalSource: Unite.AI, 2026

Those numbers explain why every serious agent team has already built some version of this. We route through a filtering layer that decides which MCP servers are even in scope for a given user intent before the request is assembled. That layer is custom code, it has its own failure modes, and it is a maintenance tax. Google is now offering to absorb it.

Server-side retrieval, one request

1
Request assembled

Full tool list travels with the request; deferred tools contribute name and short description only.

↓
2
tool_search_call

Model names the tool it wants. Gemini runs the search server-side — this is an additional model call with full context.

↓
3
tool_search_result

API injects the full parameter schema at the point of load, preserving the cached prefix above it.

↓
4
function_call

Normal function calling resumes. Your code executes and returns a function_result.

The caching trap the announcement doesn't foreground

Google's blog says Tool Retrieval has no separate charge and that you save tokens "when the schemas you never load outweigh the ones you do." Both true. What it moves past quickly is that each server-side search fires another model call carrying the full context, reported as tool-use tokens and billed at the input rate.

That inverts the economics for a specific and very common profile: a modest, stable tool catalogue sitting at the top of the prompt where implicit caching already discounts it heavily. Google's own documentation includes a second worked example where a 10-tool setup with a 30,000-token context costs 68,000 tokens statically and about 92,830 with retrieval — retrieval loses, badly. An independent cost model at Gemini 4 Argon rates found the break-even for a cached 120-tool agent lands around a search on one request in thirteen.

!

Deferring everything because deferring is free

The flag is per-tool and the feature is unmetered, so the instinct is to defer the whole catalogue. But every deferral increases the chance the model searches, and every search is a full-context model call. Teams with good prefix cache hit rates can turn a cheap static prompt into an expensive dynamic one in a single config change.

Fix: keep your top 5–10 highest-frequency tools statically loaded, defer only the long tail, and instrument total_tool_use_tokens and cached-token counts against real traffic before and after. Measure the search rate — it is the variable that decides everything.

Server-side vs. client-side: pick based on who owns permissions

There are two modes, and they are not combinable within a request — exactly one tool_search definition is allowed.

DimensionServer-side (default)Client-side (execution: "client")
Who runs the searchGemini, no index to hostYour app — your registry, embeddings, ranking
Round tripsResolves inside one requestOne extra round trip per search
Tools declared upfrontYes, full array every requestNo — tools can appear mid-conversation
Best fitLarge, relatively fixed cataloguesPer-user permission filters, user-connected integrations

For multi-tenant products this is the decision point. If which tools a user can see depends on their role, their org's enabled integrations, or a license tier, server-side search has no visibility into any of that — it will happily surface a tool the caller isn't entitled to call. Client-side retrieval keeps the permission boundary where it belongs, at the cost of a round trip. It also lets you expose tools the moment a user connects an integration, which server-side mode can't do because declarations aren't stored between requests.

The operational constraints to budget for

Three preview-era details will shape your implementation more than the headline feature does.

Retrieved schemas can't be unloaded. Once loaded, a schema is billable input for the rest of the conversation. Long-running agents accumulate context monotonically; your savings decay over the life of a session.

The full tools array must be resent on every request — including turns chained with previous_interaction_id. Tool declarations aren't persisted server-side, so your payload size doesn't shrink even though your billed context does.

Interactions API only. If you're still on generateContent, this is not a config change — it's a migration, the same gate that applies to other recent Gemini agent features. And Google states the preview surface may change before GA, which argues for keeping deferred-tool configuration in exactly one place in your codebase.

One more from Google's best practices that will bite quietly: don't defer tools whose names appear in your system instructions or in other tools' outputs, because the model may try to call them before loading them. Your agent loop should also check for function_call steps rather than trusting interaction status, since a failed search terminates in plain text.

Where this sits competitively

Google is third to ship this pattern, and all three converge on the same defer_loading vocabulary — Anthropic's tool search is documented as stable with a 10,000-deferred-tool cap and published accuracy guidance, OpenAI's lives in the Responses API. Google's preview has not published a tool limit, the size of the fixed tool_search block, or any accuracy benchmark. For a feature whose entire pitch is "keep tool selection accurate as your agent scales," the absence of an accuracy number is the loudest silence in the announcement.

What we'd actually do

Run a two-week spike, not a migration. Take one agent with a genuinely large catalogue — ideally one where multiple MCP servers are in play — and build it twice: once on your existing retrieval-based selection layer, once with defer_loading on the MCP server entries. Compare three things, in order: tool-selection accuracy on a fixed eval set, total input plus tool-use tokens at realistic traffic, and p95 latency.

If your custom routing layer wins on accuracy, keep it and use client-side tool_search as the transport — you get the platform's step model without surrendering your ranking logic. If the platform wins, you delete code, which is the best outcome available. Either way the honest default for a small, stable, well-cached toolset remains: change nothing. We've written before about where orchestration logic should live, and the principle holds here — move a responsibility to the platform when the platform measurably does it better, not when it merely offers to. If you're weighing this against an existing routing layer, we're happy to compare notes.

Frequently Asked Questions

What is Tool Retrieval in the Gemini API?

It's a preview feature in the Gemini Interactions API that defers tool parameter schemas until the model requests them. You add a tool_search tool and set defer_loading: true on chosen functions. Deferred tools still show their name and description, so the model knows they exist, but the schema stays out of context until it asks for the tool by name.

Does Tool Retrieval cost extra?

There's no separate fee, but it isn't free. Enabling tool_search adds a small fixed block of input tokens, each loaded schema is billed as input for the rest of the conversation, and every server-side search triggers an additional model call carrying full context, billed at the input rate. Net savings depend on your search frequency and how well your prefix cache was already working.

Which Gemini models support it?

Google states Tool Retrieval works with Gemini 3.6 and later, including all Gemini 4 models, in the Interactions API. Reported supported models include Gemini 3.6 Flash, Gemini 3.8 Flash and the Gemini 4 family. Setting defer_loading on an unsupported model returns a 400 error. The older generateContent method does not support the feature at all.

How does it work with MCP servers?

Set defer_loading: true on an mcp_server tool entry and every tool that server exposes is loaded on demand — you don't enumerate them individually. Deferred MCP tools still execute remotely through the Gemini API's MCP support. This is the most immediately useful part for teams running several MCP servers behind one agent.

When should we not use it?

When your catalogue is small and stable and your prompt prefix caches reliably. A static block of definitions at the top of the prompt is billed at the heavily discounted cached rate, while each retrieval search is billed at full input rate. Google's own documentation includes an example where a 10-tool setup costs more with retrieval than without. Measure your production token counts first.

Gemini APIAI agentsMCPfunction callingtool retrievalGoogleagent architectureLLM cost optimization

Published

AI-assisted writing · Reviewed by the Twarx research team

Share:
Share

Research digest

AI Research Briefing

Honest insights on AI agents, Small Language Models, and local RAG. No hype. Only when we have something worth sending.

  • No hype, just measurable outcomes
  • Read by 2,400+ engineers
  • Unsubscribe anytime

Continue reading

More from Articles