mirror of
https://github.com/open-webui/open-webui.git
synced 2026-05-08 12:58:11 -05:00
[GH-ISSUE #21760] OpenAPI tool servers — frontend sends empty tool_servers=[] so middleware never injects schemas #35089
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @antonioromero-pm on GitHub (Feb 23, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21760
Check Existing Issues
Installation Method
Docker
Open WebUI Version
v0.8.3 (Docker,
ghcr.io/open-webui/open-webui:main, built 2026-02-14)Ollama Version (if applicable)
0.16.3
Operating System
Windows 11 + WSL2 Ubuntu 24.04
Browser (if applicable)
No response
Confirmation
README.md.Description
When OpenAPI-type tool servers are configured in Admin Panel > Settings > External Tools, the model never receives their schemas and cannot call any tools. The failure is completely silent — no error is shown to the user and the chat completes normally without tool use.
Expected Behavior
The
tool_serversfield in the request payload should contain the OpenAPI specs for all enabled tool servers, so thatmiddleware.pycan inject them as atoolsarray into the upstream model request.Actual Behavior
The
tool_serversfield is always[](empty array) even when tool servers are configured, verified, and toggled on.The
tool_idsfield is correctly populated (e.g.["server:1", "server:open-meteo", "server:3"]) but the middleware receives no specs to work with.Steps to Reproduce
OpenAPI/api/chat/completionsrequest in browser DevTools > Network tabLogs & Screenshots
Request payload from DevTools:
Logs
Backend log during the request:
No tool-related log lines appear. By contrast, MCP-type tool servers (with
server:mcp:*prefixed IDs) work correctly because their execution path is fully server-side.Additional Information
https://github.com/open-webui/open-webui/issues/21770 is directly related -- the other half of the same fix.
Root Cause Analysis (traced through source)
middleware.pyline 2274 reads tool server specs from the frontend request:Line 2441 skips the entire tool injection block if this is falsy:
An empty list
[]is falsy, so no tools are ever injected.The backend does have a populated cache:
app.state.TOOL_SERVERSis correctly built at startup bymain.py:However,
app.state.TOOL_SERVERS(andget_tool_servers()) is never referenced inmiddleware.py:The middleware relies entirely on the frontend to embed specs in the request, but the frontend never does so for admin-configured OpenAPI tool servers.
Suggested Fix
After line 2274 in
middleware.py, add a fallback to the server-side cache when the frontend sends an empty array:Note:
get_tool_serversis already importable fromopen_webui.utils.tools— it just needs to be added to the import at the top ofmiddleware.py.The
tool_idsmatching needs to check bothserver:{id}(string name) andserver:{idx+1}(1-based numeric position) because the frontend generates IDs inconsistently — some servers get their configured string ID, others get a positional integer.Additional Notes
server:mcp:*IDs) are unaffected — they are handled server-side and work correctlyUSER_PERMISSIONS_FEATURES_DIRECT_TOOL_SERVERSconfig suggests frontend-embedded specs are intended as a user-facing "direct tool servers" feature — admin-configured OpenAPI servers appear to share this broken path unintentionally@antonioromero-pm commented on GitHub (Feb 23, 2026):
Updated the description after further analysis and arriving at a fix that works in my environment. Will submit a second related issue, both of which must be fixed to get this working.
@tjbck commented on GitHub (Feb 23, 2026):
Unable to reproduce.