{"type":"post","id":"tool-retrieval-gemini-api-ddf0cb","slug":"tool-retrieval-gemini-api-ddf0cb","title":"Tool retrieval - Gemini API","description":"For large tool libraries, Gemini can search a library and load only the schemas needed during a conversation (aistudio.google.com).","retrieval_nugget":"For large tool libraries, Gemini can search a library and load only the schemas needed during a conversation (aistudio.google.com).","published_at":"2026-11-28","updated_at":"2026-11-28","record_date":"2026-11-28","date_kind":"published_at","topics":["gemini","google"],"entities":["Google","Gemini API","Interactions API","Model Context Protocol"],"related_patterns":["agent-protocols-become-interoperability-layer","harness-architecture-outlives-model-choice"],"novelty_label":"new_fact","what_changed":null,"prior_refs":[],"source_url":"https://aistudio.google.com/docs/tool-retrieval","source_urls":["https://aistudio.google.com/docs/tool-retrieval"],"production":{"schema":"newruntime-production-v1","desk":"newsroom","first_seen_at":"2026-11-28T08:19:46.541Z","independent_sources":1,"notes_synthesized":null,"writer_model":"gpt-6-luna","critic":null,"checks":["primary_source_verified","source_fresh","one_story","copy_contract"],"novelty":null,"editorial_value":"high","human_review":"selective"},"citations":[{"claim":"For large tool libraries, Gemini can search a library and load only the schemas needed during a conversation.","quotes":["Tool retrieval lets Gemini search your tool library and load only the schemasit needs during a conversation. You declare your tools once and defer the onesto withhold from the initial context."],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=Tool%20retrieval%20lets%20Gemini%20search%20your%20tool%20library%20and%20load%20only%20the%20schemasit%20needs%20during%20a%20conversation.%20You%20declare%20your%20tools%20once%20and%20defer%20the%20onesto%20withhold%20from%20the%20initial%20context.","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"},{"claim":"The feature is in preview, requires the v1beta API, and is available through the Interactions API—not generateContent.","quotes":["Tool retrieval is in preview and requires the v1beta API version. The API surface may change beforegeneral availability.","Tool retrieval is available on the Interactions API. The generateContent method doesn'tsupport it."],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=Tool%20retrieval%20is%20in%20preview%20and%20requires%20the%20v1beta%20API%20version.%20The%20API%20surface%20may%20change%20beforegeneral%20availability.&text=Tool%20retrieval%20is%20available%20on%20the%20Interactions%20API.%20The%20generateContent%20method%20doesn%27tsupport%20it.","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"},{"claim":"With server-side retrieval, the model initially sees each deferred tool’s name and description, then loads its full parameter schema when needed.","quotes":["To enable server-side retrieval, add {\"type\": \"tool_search\"} to your toolsarray and set defer_loading: true on each tool to withhold. The model seesthe name and description of each deferred tool, loads the full parameter schemawhen needed, and calls the function in a single API request."],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=To%20enable%20server%2Dside%20retrieval%2C%20add%20%7B%22type%22%3A%20%22tool_search%22%7D%20to%20your%20toolsarray%20and%20set%20defer_loading%3A%20true%20on%20each%20tool%20to%20withhold.%20The%20model%20seesthe%20name%20and%20description%20of%20each%20deferred%20tool%2C%20loads%20the%20full%20parameter%20schemawhen%20needed%2C%20and%20calls%20the%20function%20in%20a%20single%20API%20request.","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"},{"claim":"Search resolves within the request; your application executes the resulting functioncall.","quotes":["The API resolves tool_search_call and tool_search_result inside the samerequest, so you only execute the function_call step. Each retrieval stepincludes an encrypted signature that you must pass back unchanged if youmanage conversation history yourself (see Stateless conversations)."],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=The%20API%20resolves%20tool_search_call%20and%20tool_search_result%20inside%20the%20samerequest%2C%20so%20you%20only%20execute%20the%20function_call%20step.%20Each%20retrieval%20stepincludes%20an%20encrypted%20signature%20that%20you%20must%20pass%20back%20unchanged%20if%20youmanage%20conversation%20history%20yourself%20%28see%20Stateless%20conversations%29.","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"},{"claim":"You can also defer a remote MCP server by setting deferloading: true on its mcpserver entry alongside server-side search; the API executes a retrieved MCP tool on the server and returns its call and result steps in the same response.","quotes":["Set defer_loading: true on an mcp_server entry alongside a server-sidetool_search to defer every tool that server exposes:","When the model retrieves and calls a deferred MCP tool, the API executes it onthe remote server and returns mcp_server_tool_call andmcp_server_tool_result steps in the same response. See Remote MCP for connection setup."],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=Set%20defer_loading%3A%20true%20on%20an%20mcp_server%20entry%20alongside%20a%20server%2Dsidetool_search%20to%20defer%20every%20tool%20that%20server%20exposes%3A&text=When%20the%20model%20retrieves%20and%20calls%20a%20deferred%20MCP%20tool%2C%20the%20API%20executes%20it%20onthe%20remote%20server%20and%20returns%20mcp_server_tool_call%20andmcp_server_tool_result%20steps%20in%20the%20same%20response.%20See%20Remote%20MCP%20for%20connection%20setup.","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"},{"claim":"With client-side retrieval, your application performs the search and returns matching declarations in functionresult.result; this can introduce tools that were not in the initial tools array.","quotes":["Client-side retrieval delegates search to your application. Declare atool_search tool with execution: \"client\", a name, a description, andyour search parameters. When the model calls it, run your own lookup andreturn the matching function declarations in function_result.result."],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=Client%2Dside%20retrieval%20delegates%20search%20to%20your%20application.%20Declare%20atool_search%20tool%20with%20execution%3A%20%22client%22%2C%20a%20name%2C%20a%20description%2C%20andyour%20search%20parameters.%20When%20the%20model%20calls%20it%2C%20run%20your%20own%20lookup%20andreturn%20the%20matching%20function%20declarations%20in%20function_result.result.","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"},{"claim":"For deferred functions, shortdescription can serve as a compact retrieval summary instead of the full description.","quotes":["| short_description | Deferred function | Optional compact summary shown to the model during retrieval instead of the full description."],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=%7C%20short_description%20%7C%20Deferred%20function%20%7C%20Optional%20compact%20summary%20shown%20to%20the%20model%20during%20retrieval%20instead%20of%20the%20full%20description.","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"},{"claim":"Client-side search adds one round trip per search; server-side search adds none, but each server-side search triggers an extra model call inside the request, with the full context and loaded schemas.","quotes":["| Extra round trips per search | None | None | One per search |","Each server-side search triggers an extra model call inside the requestwith the full context plus loaded schemas."],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=%7C%20Extra%20round%20trips%20per%20search%20%7C%20None%20%7C%20None%20%7C%20One%20per%20search%20%7C&text=Each%20server%2Dside%20search%20triggers%20an%20extra%20model%20call%20inside%20the%20requestwith%20the%20full%20context%20plus%20loaded%20schemas.","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"},{"claim":"There is no separate retrieval charge: tokens use the called model’s standard input, cached-input and output rates.","quotes":["Tool retrieval has no separate charge. All tokens are billed at the standardinput, cached, and output rates for the model you call (see Pricing)."],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=Tool%20retrieval%20has%20no%20separate%20charge.%20All%20tokens%20are%20billed%20at%20the%20standardinput%2C%20cached%2C%20and%20output%20rates%20for%20the%20model%20you%20call%20%28see%20Pricing%29.","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"},{"claim":"Deferred tools’ names and short descriptions—or the first sentence of their descriptions—count as input tokens; parameter schemas are billed only once loaded.","quotes":["Deferred tools add only their name and short_description (or the firstsentence of description) to total_input_tokens. Parameter schemas arenot billed until loaded."],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=Deferred%20tools%20add%20only%20their%20name%20and%20short_description%20%28or%20the%20firstsentence%20of%20description%29%20to%20total_input_tokens.%20Parameter%20schemas%20arenot%20billed%20until%20loaded.","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"},{"claim":"A request can contain only one toolsearch entry, and tool declarations are not persisted across turns: resend the full tools array, including on functionresult follow-ups.","quotes":["You can include one tool_search entry per request. See the Interactions API reference for full field schemas.","The API doesn't persist tool declarations across turns. Pass your full toolsarray (including tool_search, deferred tools, and loaded tools) on everyrequest, including follow-up turns that return a function_result:"],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=You%20can%20include%20one%20tool_search%20entry%20per%20request.%20See%20the%20Interactions%20API%20reference%20for%20full%20field%20schemas.&text=The%20API%20doesn%27t%20persist%20tool%20declarations%20across%20turns.%20Pass%20your%20full%20toolsarray%20%28including%20tool_search%2C%20deferred%20tools%2C%20and%20loaded%20tools%29%20on%20everyrequest%2C%20including%20follow%2Dup%20turns%20that%20return%20a%20function_result%3A","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"},{"claim":"Omitting toolsearchcall or stripping a signature can produce a 400 error when sending functionresult; omitting toolsearchresult from stateless history instead drops loaded schemas from context without an error.","quotes":["Omitting tool_search_call or stripping signature from any step returns a400 error when you send back function_result. Omitting tool_search_resultdoesn't return an error, but drops the loaded schemas from context."],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=Omitting%20tool_search_call%20or%20stripping%20signature%20from%20any%20step%20returns%20a400%20error%20when%20you%20send%20back%20function_result.%20Omitting%20tool_search_resultdoesn%27t%20return%20an%20error%2C%20but%20drops%20the%20loaded%20schemas%20from%20context.","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"},{"claim":"For server-side retrieval, add {\"type\":\"toolsearch\"} to the tools array and set deferloading: true on each tool whose schema should be withheld.","quotes":["To enable server-side retrieval, add {\"type\": \"tool_search\"} to your toolsarray and set defer_loading: true on each tool to withhold. The model seesthe name and description of each deferred tool, loads the full parameter schemawhen needed, and calls the function in a single API request."],"cite_url":"https://aistudio.google.com/docs/tool-retrieval#:~:text=To%20enable%20server%2Dside%20retrieval%2C%20add%20%7B%22type%22%3A%20%22tool_search%22%7D%20to%20your%20toolsarray%20and%20set%20defer_loading%3A%20true%20on%20each%20tool%20to%20withhold.%20The%20model%20seesthe%20name%20and%20description%20of%20each%20deferred%20tool%2C%20loads%20the%20full%20parameter%20schemawhen%20needed%2C%20and%20calls%20the%20function%20in%20a%20single%20API%20request.","source_url":"https://aistudio.google.com/docs/tool-retrieval","publisher":"aistudio.google.com"}],"schema_version":"newruntime-agent-readable-v0.2","stable_id":"post:tool-retrieval-gemini-api-ddf0cb","status":"published","visuals":[],"editor":{"role":"editor","name":"Andrey Reshetnikov","profile":"https://newruntime.com/owner-profile.md","profile_json":"https://newruntime.com/owner-profile.json","same_as":["https://www.linkedin.com/in/reshetnikov1/","https://t.me/lapetuse"]},"routes":{"html":"https://newruntime.com/posts/tool-retrieval-gemini-api-ddf0cb/","markdown":"https://newruntime.com/posts/tool-retrieval-gemini-api-ddf0cb.md","json":"https://newruntime.com/posts/tool-retrieval-gemini-api-ddf0cb.json"},"markdown_url":"https://newruntime.com/posts/tool-retrieval-gemini-api-ddf0cb.md","next_reads":[{"type":"topic","path":"/topics/gemini/","url":"https://newruntime.com/topics/gemini/","title":"Gemini","reason":"Explore the gemini topic hub.","media_type":"text/html","markdown_url":"https://newruntime.com/topics/gemini.md","json_url":"https://newruntime.com/topics/gemini.json"},{"type":"topic","path":"/topics/google/","url":"https://newruntime.com/topics/google/","title":"Google","reason":"Explore the google topic hub.","media_type":"text/html","markdown_url":"https://newruntime.com/topics/google.md","json_url":"https://newruntime.com/topics/google.json"},{"type":"collection","path":"/posts/","url":"https://newruntime.com/posts/","title":"Field Notes","reason":"Open the latest editorial analysis.","media_type":"text/html","json_url":"https://newruntime.com/posts.json"},{"type":"collection","path":"/sources/","url":"https://newruntime.com/sources/","title":"Sources","reason":"See the original sources this archive cites.","media_type":"text/html"}]}
