How Gemini API Tool Retrieval Works and How It Differs from File Search

Learn how Gemini API Tool Retrieval loads function schemas on demand using the Interactions API, how it differs from File Search, and how developers can use both in production.

How Gemini API Tool Retrieval Works and How It Differs from File Search

On 19 Nov 2026 Google launched Tool Retrieval in the Gemini API in preview on the Interactions API. The feature keeps a large tool library on standby and loads full parameter schemas only when the current task needs them—via <code>tool_search</code> and <code>defer_loading: true</code>. This guide separates Tool Retrieval from File Search and Function Calling, then covers setup signals, supported models, and token-based cost rules. Confirm live contracts on Google AI for Developers (Gemini API docs) and Gemini API pricing before you ship.

Blog / Feature Article Screenshot

What Is Tool Retrieval in the Gemini API?

Tool Retrieval solves a scaling problem for agents that expose dozens or hundreds of functions: stuffing every full parameter schema into every prompt inflates input tokens, adds latency, and hurts tool-selection accuracy. Google’s announcement states the model still sees each deferred tool’s name and description, but schemas stay out of context until needed.

<strong>Key facts (as of the 19 Nov 2026 announcement)</strong>:

ItemOfficial signal
Launch date19 Nov 2026
StatusPreview
API surfaceInteractions API
Search entrytool_search tool
Defer flagdefer_loading: true on function / MCP tools
ModelsGemini 3.6 and later, including Gemini 4 models
Separate feeNo — billed as normal model tokens

Not the same as File Search

Tool Retrieval selects and loads <em>function tool definitions</em>. It is not a document RAG indexer. File Search is the separate product that imports files, embeds them, and retrieves snippets for grounding. You can combine both in one agent, but they solve different problems.

Photo: What tool retrieval means for gemini api developers

How Gemini API Tool Retrieval Works

Enable Tool Retrieval by adding a <code>tool_search</code> tool and setting <code>defer_loading: true</code> on tools you want held back. Inside one Interactions request the model can emit a tool search, receive schemas, then emit a normal <code>function_call</code>—all visible in <code>interaction.steps</code> for debugging.

Illustrative structure based on Google’s announcement (validate model ID and SDK version against live docs before production):

<pre><code>from google import genai client = genai.Client() tools = [ {“type”: “tool_search”}, { “type”: “function”, “name”: “issue_refund”, “description”: “Refund an order”, “defer_loading”: True, “parameters”: { “type”: “object”, “properties”: { “order_id”: {“type”: “string”}, “amount”: {“type”: “number”}, }, “required”: [“order_id”, “amount”], }, }, ] interaction = client.interactions.create( model=”gemini-4-hydrogen”, input=”Refund order A-1042 for $40″, tools=tools, ) print(interaction.steps)</code></pre>

Keep hot-path tools undeferred if you call them on almost every turn; defer the long tail. Tool Retrieval also works with remote MCP servers when <code>defer_loading</code> is set on the MCP tool. Full walkthroughs live on Gemini API docs.

Gemini Tool Retrieval vs File Search

Use this table when designing an agent that needs both live actions and grounded document answers.

CapabilityWhat it retrievesTypical use
Tool RetrievalFunction / MCP tool schemas (on demand)Large tool catalogs without stuffing every schema
File SearchDocument chunks from an indexed corpusPolicy / FAQ / manual grounding (RAG-style)
Function CallingStructured calls your app executesRefunds, tickets, DB lookups, side effects

How to Set Up Gemini API File Search

File Search remains a separate pipeline: create or select a searchable store, upload allowed files, index them, attach File Search as a tool, then query. Prefer parameter names and limits on File Search documentation and the overview on ai.google.dev Gemini API docs—not third-party paraphrases.

Operational check: if retrieval returns no supporting snippet, treat the turn as a miss and refuse to invent policy text. Log store IDs and matched document IDs before rendering answers.

Combining Tool Retrieval with Function Calling

Architect layers with explicit contracts: Function Calling exposes typed tools; Tool Retrieval decides which deferred schemas enter context; File Search (optional) grounds prose in indexed documents. Overlapping tool descriptions (e.g. search_orders vs find_order) still cause wrong-tool paths—shadow-eval expected tool sequences before go-live.

Prompt policy example: prefer File Search for static policy facts; prefer functions for live account state; answer from conversation only when neither applies. Empty retrieval should yield “insufficient evidence,” not confident guesses.

Product Homepage Screenshot

Supported Models and API Requirements

Per Google’s announcement, Tool Retrieval works with <strong>Gemini 3.6 and later</strong>, including Gemini 4 models, on the <strong>Interactions API</strong>. New projects should prefer Interactions; generateContent remains supported for existing stacks but is not the surface described for Tool Retrieval preview. Confirm availability on Gemini API docs.

Pricing Plans Screenshot

Gemini API Pricing and Usage Costs

Tool Retrieval has <strong>no separate product fee</strong>. Input and output tokens bill at the standard rates for the model you call. Enabling <code>tool_search</code> adds a small fixed block of input tokens; each loaded schema is billed as input for the rest of the conversation—same as declaring the tool up front. You save tokens when deferred schemas you never load outweigh the ones you do.

API pricing is <strong>token-metered by model and tier</strong>, not per-seat SaaS. Example snapshot for <strong>Gemini 4 Carbon Standard</strong> as published on ai.google.dev/pricing (verify before budgeting; tiers change): input <strong>$2.00 per 1M tokens</strong>, output <strong>$10.00 per 1M tokens</strong> on the current Standard ladder, with announced Standard changes effective <strong>1 Dec 2026</strong> (input $4 / 1M, output $20 / 1M). Other Gemini models use different rates; Batch/Flex ladders differ from Standard. Carbon is not on the free tier.

Cost driverHow it bills
Tool RetrievalNo separate fee; model token rates apply
Loaded tool schemasCounted as input tokens after load
File Search indexingEmbedding generation charged when you build the index
File Search storageFree (per current File Search docs)
File Search query embeddingFree at query time (per current docs)
Retrieved document tokensBilled as normal model input context
Function Calling side effectsModel tokens + your external service costs

Security, Logging and Production Considerations

Scope API keys (or workload identity) separately for staging and production so a leaked staging key cannot read production corpora or invoke live write tools. Log tool_search → schema load → function_call chains from interaction.steps. Cap retries with jitter: tool-heavy turns multiply requests per user action and can hit rate limits before dollar budgets.

Who Should Use Gemini Tool Retrieval?

<strong>Good fit:</strong> agents with large or growing tool libraries, MCP servers with many tools, or prefix-cache sensitive prompts where deferred schemas must stay out of the cached prefix.

<strong>Poor fit (for now):</strong> prototypes with fewer than ~10 tools where full schemas already fit comfortably; stacks that cannot move to the Interactions API yet; workloads that need only document RAG without function tools—use File Search alone instead.

Research Methodology

This article is a research brief synthesized from Google’s Tool Retrieval announcement, Gemini API developer documentation, and published pricing pages as of 20 Nov 2026. It does not claim multi-week production soak tests. Re-verify model IDs, preview status, and dollar figures before shipping.

Verdict

Tool Retrieval is worth adopting when your Interactions-based agent already drowns in tool schemas. Treat it as a preview capability: separate it cleanly from File Search, keep hot tools undeferred, and budget on token meters—not seat licenses. Re-read the official announcement and docs before you lock production model IDs.

FAQ

What is Gemini API Tool Retrieval?
A preview Interactions API feature that uses tool_search and defer_loading so agents load full function schemas only when needed, instead of sending every schema on every prompt.
How is Tool Retrieval different from File Search?
Tool Retrieval loads function/MCP tool definitions on demand. File Search indexes documents and retrieves snippets for grounding. They can run together but are not the same subsystem.
Does Tool Retrieval have a separate price?
No. Google bills standard model input/output tokens. tool_search adds a small fixed input block; loaded schemas count as input tokens.
Which models support Tool Retrieval?
Google states Gemini 3.6 and later, including Gemini 4 models, on the Interactions API. Confirm the live model list in docs.
How do I enable defer_loading?
Add a tool_search tool to the Interactions request and set defer_loading: true on each function or MCP tool you want deferred. Inspect interaction.steps for tool_search_call and function_call.
How should I budget File Search costs?
Pay for embeddings when indexing; storage and query-time embeddings are free per current File Search docs; retrieved tokens bill as normal model input. Always re-check ai.google.dev/pricing.