feat: Tool Search / Lazy Tool Loading for Large Tool Sets
Before Submitting
- I searched open and closed issues and discussions for an existing request.
- I checked whether this already exists on the
devbranch or latest source. - I understand that maintainers want a well-written issue or discussion before any code pull request.
- This request is not a security vulnerability.
Problem
When tools or MCP servers are configured on a model, Open WebUI injects every tool's full JSON schema into the tools array of every API request, regardless of whether the tool is relevant to the current turn, whether the user has toggled it off in the chat UI, or whether the model will ever invoke it in the conversation.
This creates a compounding cost problem that scales with tool count, in addition to preventing usage entirely if the tools payload exceeds what the model can handle:
| Configuration | Measured Overhead (per request) |
|---|---|
| Moderate tool set (~39 tools, e.g. Jira + Confluence MCP) | ~25,000 extra tokens |
| Maxed out tool set (~128 tools) | ~200k extra tokens |
The only current workaround is maintaining parallel model configurations (one with tools, one without), which is fragile, confusing for end users, and defeats the purpose of having a unified chat interface.
For users who have embraced MCP as the ecosystem intends, ie connecting multiple specialized servers (search, databases, ticketing, CI/CD, observability, code tools, etc.) this makes it very difficult to scale. Users hit context window limits prematurely, pay significantly inflated API costs, and experience degraded model performance because the signal-to-noise ratio in the prompt drops as tool definitions crowd out actual conversation context.
The only current workaround is maintaining parallel model configurations (one with tools, one without), which is fragile, confusing for end users, and defeats the purpose of having a unified chat interface.
Almost every mainstream LLM client has implemented this now and it seems like an obvious gap. Yes, you can implement something a layer up if you're running a gateway but that approach is cumbersome and requires something that folks may not have.
Desired Behavior
Implement a tool search / deferred tool loading mechanism so that large tool sets don't saturate the context window. The model receives a lightweight tool manifest (name + short description) and a search_tools meta-tool, then loads full schemas on demand only when relevant.
Proposed approach:
Threshold-based deferral: Tools whose full JSON schema exceeds a configurable token/character threshold are deferred. Their name and a truncated description appear in a compact manifest block, but their full schema is not included in the tools array. search_tools built-in tool: A new built-in tool (analogous to the existing view_skill pattern) that the model can call to search deferred tools by keyword and retrieve their full schemas. The search can be simple (BM25 / keyword match over tool names and descriptions) — it doesn't need to be sophisticated. Always-loaded allow-list: An admin/user-configurable list of tools that are never deferred (e.g., core built-ins like web_search, code_interpreter, frequently-used MCP tools). This ensures high-priority tools remain zero-latency. Respect the existing UI toggle: As a baseline improvement (even without full tool search), tools the user has toggled off in the chat UI should not be injected into the API request.
Example flow:
User: "Create a Jira ticket for the auth service bug we discussed"
Instead of injecting all tool schemas, the model sees: 5 always-loaded tools (full schemas) + a manifest: "x additional tools available — use search_tools to find relevant ones"
Model calls: search_tools(query="jira ticket create") → Returns full schemas for: jira_create_issue, jira_search, jira_add_comment
Model calls: jira_create_issue({...}) → Done.
Why This Matters
IMO This is now table-stakes for LLM tool clients Tool search / deferred tool loading is no longer a niche optimization, it has become a standard capability across mainstream LLM clients in 2026:
| Client | Tool Search Support | Implementation |
|---|---|---|
| Claude Code | ✅ Native | Anthropic advanced-tool-use beta, BM25-based |
| Claude Desktop | ✅ Native | Same mechanism via MCP |
| ChatGPT | ✅ Native | Dynamic tool selection |
| Cursor | ✅ Native | Tool filtering per-request |
| Windsurf | ✅ Native | Selective tool injection |
| Continue | ✅ Native | MCP tool search support |
| Gemini CLI | ✅ Native | Dynamic tool discovery |
| Open WebUI | ❌ Not supported | All schemas injected always |
Open WebUI is arguably the most prominent open-source LLM frontend, and MCP is the single most important external integration. Users adopting MCP across their stack will hit this wall quickly, and finding that every other client they use handles this gracefully except Open WebUI is a significant gap.
"Just handle it at your MCP gateway" is not an acceptable solution The response to #24950 suggested users follow Anthropic's tool search pattern externally. This shifts the burden to every individual user and has real problems:
It requires a custom MCP proxy/gateway - most users connect MCP servers directly and shouldn't need intermediary infrastructure to get reasonable token efficiency. It can be an optional feature, but I strongly suspect it's an optional feature that people want. It fragments the solution - every gateway, proxy, and custom pipe implements this differently (or not at all). The Anthropic Manifold Pipe community plugin has implemented this beautifully, but it only works for Anthropic models via a manifold pipe. Users on OpenAI, Gemini, local models, or LiteLLM proxies get nothing. The client is the right place for this. The client knows which tools are configured, has access to the conversation context, and controls the tools array in the request payload. This is exactly why Claude Code, Cursor, and every other client listed above implemented it at the client level. It undermines Open WebUI's value proposition. Open WebUI is a unified interface - the selling point is that you configure your tools and models in one place and it handles the complexity. Telling users to build their own tool search infrastructure outside the UI contradicts that.
Who benefits
Power users with multiple MCP servers - the primary audience for this feature, and a growing segment as MCP adoption accelerates Enterprise/team deployments - where admin-configured MCP servers may expose dozens of tools across integrations, and per-request cost matters at scale Local model users - smaller context windows (8k–32k) are hit even faster; 20k tokens of tool schemas can consume most of their even with a relatively small lineup
Examples or References
- Anthropic's tool search documentation: Advanced tool use — Tool search MCP specification: The protocol itself includes tool discovery/listing as a core primitive
- Community implementation proving feasibility: Podden/openwebui_anthropic_api_manifold_pipe — implements ENABLE_TOOL_SEARCH with BM25/regex, configurable deferral threshold, and exclude lists. This demonstrates the pattern works well within the Open WebUI plugin architecture and could inform a native implementation.
- Previous issues: #24950, #25592, #20549, #22634
Alternatives or Workarounds
I'm happy to build this, just wanted to put together a detailed FR before proceeding. @tjbck + @Classic298 if you're strongly philosophically opposed please let me know and I won't waste my time, but I very much think this is worth pursuing based on real world usage.
Source: open-webui/open-webui