-
Notifications
You must be signed in to change notification settings - Fork 796
Open
Description
Summary
Both Anthropic (Claude Sonnet 4.0+) and OpenAI (GPT-5.4+) now support deferred tool loading and tool search at the API level. The Gemini API currently lacks this capability.
Same feature request as googleapis/js-genai#1416 — filing here for visibility across both SDKs since this is an API-level feature.
Problem
When building AI agents with many tools (30+):
- Context bloat: All tool schemas consume context tokens upfront. A typical multi-server MCP setup can consume 50k+ tokens in tool definitions alone.
- Tool selection accuracy: Model accuracy degrades beyond 30-50 tools.
- Client-side workarounds break caching: Pre-filtering tools before each API call changes the tools parameter, invalidating prefix cache.
What competitors have
Anthropic
- defer_loading: true on tools — schema sent but not rendered into model context
- tool_search_tool_regex/bm25 — model searches deferred tools, matched schemas expanded within same API call
- Zero extra round-trips, cache preserved
- Up to 10,000 tools
OpenAI
- Same defer_loading: true mechanism
- Namespaces to group tools — model only sees group name + description
- Discovered schemas injected at end of context window to preserve cache
- Hosted and client-executed search modes
Proposed for Gemini API
- defer_loading: true on functionDeclarations
- Built-in tool_search tool for on-demand discovery
- Automatic schema expansion within generateContent call
Related issues
- Feature Request: Support defer_loading and tool_search for dynamic tool discovery (parity with Anthropic & OpenAI) js-genai#1416 (same request, JS SDK)
- Error when both search and function calls are in the tools[] config option js-genai#435 (search + function calling cannot be combined)
- Tool urlContext - Error 400 "Multiple tools are supported only when they are all search tools." - Is this wanted behavior? js-genai#1157 (urlContext + functionDeclarations cannot be combined)
- [Feature Request] Increase MCP tool limit from 100 to 500 google-gemini/gemini-cli#21823 (100 tool limit)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels