Gemini Tool Retrieval: Power-User Guide to tool_search and defer_loading

Last updated: November 21, 2026

Gemini tool retrieval, a preview added to the Interactions API on November 19, 2026, lets Gemini search your tool library and load function schemas only when needed. You mark tools with defer_loading and add a tool_search tool, or run your own search on the client. It has no separate charge.

Contents

What changed on November 19

The Gemini API changelog entry for November 19, 2026 lists Tool retrieval (Preview) next to the general availability of Genie 4. Google says the Interactions API “can now search your tool library and load function schemas on demand,” so large tool sets no longer need to be sent to the model in full on every request.

The main points from the changelog and the tool retrieval guide:

  • Mark tools with defer_loading: true and add {"type": "tool_search"} so Gemini retrieves schemas for you.
  • Client-side retrieval and remote MCP servers are also supported.
  • It works with Gemini 3.6 and later models, including all Gemini 4 models, on the Interactions API (v1beta) only.

Our Gemini 4 Hydrogen API and pricing guide covers the model that Google uses in its tool retrieval examples.

Why tool retrieval matters

Google’s guide states the problem directly: 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.

With retrieval, the model first sees only the name and a short description of each deferred tool. It loads the full parameter schema only for the tools it decides to use.

Server-side vs client-side retrieval

Google supports two retrieval modes plus classic static loading. This comparison is adapted from the official guide:

Capability Static loading Server-side retrieval Client-side retrieval
How tools reach the model All schemas sent every request Gemini loads deferred schemas on demand Your app returns schemas on demand
Retrieval code you write None None Search, ranking and filtering logic
Tools declared up front Yes Yes No
Works with remote MCP servers Yes Yes Not applicable
Extra round trips per search None None One per search
Best for Fewer than 20 stable tools Large, known tool libraries and MCP servers Dynamic registries, namespaces or per-user tools

Google recommends server-side retrieval for latency-sensitive apps because searches run inside one API call.

How to turn on server-side retrieval

  1. Use the right API. Create the client with the v1beta API version and call the Interactions API (client.interactions.create in the Python SDK). The generateContent method does not support tool retrieval.
  2. Pick a supported model, such as gemini-4-hydrogen, gemini-4-neon or gemini-3.8-flash.
  3. Add the search tool. Put {"type": "tool_search"} in your tools array. Only one tool_search entry is allowed per request.
  4. Defer the long tail. Set defer_loading: true on each function you want withheld, and keep the full parameters schema on it. Leave your most-used tools loaded.
  5. Read the steps. The response contains tool_search_call and tool_search_result steps, which the API resolves itself, followed by a function_call step that your application executes.
  6. Return the result. Send a function_result with previous_interaction_id, and pass the full tools array again, because the API does not persist tool declarations across turns.

If you manage history yourself with store=false, append every model step unchanged. Omitting a tool_search_call step or stripping a signature field returns a 400 error when you send back a function_result.

Client-side retrieval and MCP servers

For client-side retrieval, declare a tool_search tool with execution: "client", a name, a description and your own search parameters, for example a query and a namespace filter. When the model calls it, run your lookup and return complete function declarations in function_result.result. This lets you inject per-user tools mid-conversation.

For remote MCP servers, set defer_loading: true on the mcp_server entry alongside a server-side tool_search. Every tool that server exposes is then deferred, and the API runs retrieved MCP tools on the remote server, returning mcp_server_tool_call and mcp_server_tool_result steps.

Pricing and token usage

According to Google, tool retrieval has no separate charge. Tokens are billed at the standard input, cached and output rates for the model you call:

  • Deferred tools add only their name and short_description (or the first sentence of description) to total_input_tokens. Parameter schemas are not billed until loaded.
  • Each server-side search triggers an extra model call inside the request. Those prompt tokens are reported in total_tool_use_tokens and billed at the input rate.

Google notes that with small libraries, or long contexts that search on every turn, static loading can cost less.

Model token prices are covered in our Gemini 4 Neon pricing and API guide.

Gemini vs Claude tool search

Anthropic’s tool search tool for the Claude Messages API solves the same problem with a similar defer_loading flag. The main differences, based on both vendors’ documentation:

Aspect Gemini tool retrieval Claude tool search tool
Status Preview, v1beta Interactions API Documented feature of the Messages API
Search method One tool_search tool, server or client execution Regex and BM25 variants, plus custom client-side search
Published limits Not stated in the guide 10,000 deferred tools per request; 5 results per search by default
Gemini billing No separate charge; search calls billed as input tokens Not compared here

Anthropic says a typical multi-server setup can use about 55,000 tokens in tool definitions and that tool search typically cuts this by over 85 percent. Google has not published a comparable figure for Gemini.

Workflows and settings that work well

  • Keep core tools loaded. Leave defer_loading unset on tools used on most turns and defer the rest.
  • Do not defer tools named in prompts. If your system instructions or tool outputs mention a tool by name, the model may call it without searching first.
  • Check steps, not status. Inspect interaction.steps for function_call entries on every response, because status is not always requires_action.

For other agent tooling on Google’s stack, see our Gemini API CLI guide, our Gemini computer use tool guide and our Genie 4 Interactions API guide.

Limitations and common errors

  • Preview: the API surface may change before general availability.
  • One mode per request: server-side and client-side retrieval cannot be combined.
  • No unloading: loaded tools stay in context for the rest of the conversation.
  • Soft failures: a search that matches no deferred tool produces a text response, not a structured error.
  • Unsupported model: other models return “deferred loading is not supported for this model”.

Frequently asked questions

What is Gemini tool retrieval?

Tool retrieval is a preview feature of the Gemini Interactions API, announced in the Gemini API changelog on November 19, 2026. It lets Gemini search your tool library and load full function schemas only when it needs them, instead of receiving every schema on every request.

How do I turn on tool retrieval in the Gemini API?

Use the v1beta Interactions API, add {“type”: “tool_search”} to the tools array, and set defer_loading: true on each function or remote MCP server you want to withhold.

Does Gemini tool retrieval cost extra?

No separate charge applies. Google bills tokens at the normal input, cached and output rates for the model. Each server-side search adds an extra model call whose prompt tokens appear in total_tool_use_tokens and are billed at the input rate.

Which models support Gemini tool retrieval?

Google lists gemini-4-carbon, gemini-4-neon, gemini-4-hydrogen, gemini-4-argon, gemini-3.8-flash and gemini-3.6-flash.

How is it different from Claude’s tool search tool?

Both defer tool schemas with defer_loading. Anthropic offers regex and BM25 search variants and documents a limit of 10,000 deferred tools per request. Google offers one server-side tool_search entry plus a client-side mode where your own code runs the search.

Sources

Image: Google Gemini logo by Google LLC, public domain (trademarked), via Wikimedia Commons. Placed on a white background and resized. Gemini is a trademark of Google LLC. FreeAnswers is not affiliated with or endorsed by Google.

Related answers

Leave a Comment