[GH-ISSUE #21557] bug: /api/v1/chat/completions ignores caller tools and may advertise unavailable server tools #35045

Closed
opened 2026-04-25 09:15:08 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @exxocism on GitHub (Feb 18, 2026).
Original GitHub issue: https://github.com/open-webui/open-webui/issues/21557

Check Existing Issues

  • I have searched for any existing and/or related issues.
  • I have searched for any existing and/or related discussions.
  • I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!).
  • I am using the latest version of Open WebUI.

Installation Method

Git Clone

Open WebUI Version

dev (v0.8.3)

Ollama Version (if applicable)

No response

Operating System

any

Browser (if applicable)

No response

Confirmation

  • I have read and followed all instructions in README.md.
  • I am using the latest version of both Open WebUI and Ollama.
  • I have included the browser console logs.
  • I have included the Docker container logs.
  • I have provided every relevant configuration, setting, and environment variable used in my setup.
  • I have clearly listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc).
  • I have documented step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation. My steps:
  • Start with the initial platform/version/OS and dependencies used,
  • Specify exact install/launch/configure commands,
  • List URLs visited, user input (incl. example values/emails/passwords if needed),
  • Describe all options and toggles enabled or changed,
  • Include any files or environmental changes,
  • Identify the expected and actual result at each stage,
  • Ensure any reasonably skilled user can follow and hit the same issue.

Expected Behavior

When I send POST /api/v1/chat/completions with an explicit OpenAI-style tools array, only those caller-provided tools should be advertised/exposed to the model and used for tool calling.
Server-side tools (tool_ids, tool_servers, builtin native tools) should not override the request payload when tools is explicitly provided.

Actual Behavior

/api/v1/chat/completions can ignore the caller-provided tools payload and replace it with server-resolved tools (including builtin native tools), causing:

  • tools to be advertised that the caller did not provide
  • tool calls to functions not present in the request tools

Steps to Reproduce

  1. Start Open WebUI from a fresh clone of dev (or latest) and configure any working OpenAI-compatible model.
  2. Obtain an API token and confirm the model ID available in Open WebUI.
  3. Send this request (replace placeholders):
curl -X POST "http://localhost:3000/api/v1/chat/completions" \
  -H "Authorization: Bearer <TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "<MODEL_ID>",
    "stream": false,
    "messages": [
      {"role":"user","content":"What time is it right now? Use a tool if needed."}
    ],
    "params": {"function_calling":"native"},
    "tools": [
      {
        "type":"function",
        "function":{
          "name":"only_allowed_tool",
          "description":"Dummy tool that should be the only available tool.",
          "parameters":{"type":"object","properties":{}}
        }
      }
    ]
  }'
  1. Observe that response/tool behavior may reference builtin/server tools (for example get_current_timestamp) even though request tools only contained only_allowed_tool.
  2. (Optional stronger repro) Also pass tool_ids and confirm those server-side tools appear/are used instead of caller payload.

Logs & Screenshots

  • As-is (overrides request and advertises built-in tools)
    001 asis
  • To-be (properly fills user-requested tools - cursor)
    002 tobe

Additional Information

Relevant configuration/assumptions for repro:

Originally created by @exxocism on GitHub (Feb 18, 2026). Original GitHub issue: https://github.com/open-webui/open-webui/issues/21557 ### Check Existing Issues - [x] I have searched for any existing and/or related issues. - [x] I have searched for any existing and/or related discussions. - [x] I have also searched in the CLOSED issues AND CLOSED discussions and found no related items (your issue might already be addressed on the development branch!). - [x] I am using the latest version of Open WebUI. ### Installation Method Git Clone ### Open WebUI Version dev (v0.8.3) ### Ollama Version (if applicable) _No response_ ### Operating System any ### Browser (if applicable) _No response_ ### Confirmation - [x] I have read and followed all instructions in `README.md`. - [x] I am using the latest version of **both** Open WebUI and Ollama. - [x] I have included the browser console logs. - [x] I have included the Docker container logs. - [x] I have **provided every relevant configuration, setting, and environment variable used in my setup.** - [x] I have clearly **listed every relevant configuration, custom setting, environment variable, and command-line option that influences my setup** (such as Docker Compose overrides, .env values, browser settings, authentication configurations, etc). - [x] I have documented **step-by-step reproduction instructions that are precise, sequential, and leave nothing to interpretation**. My steps: - Start with the initial platform/version/OS and dependencies used, - Specify exact install/launch/configure commands, - List URLs visited, user input (incl. example values/emails/passwords if needed), - Describe all options and toggles enabled or changed, - Include any files or environmental changes, - Identify the expected and actual result at each stage, - Ensure any reasonably skilled user can follow and hit the same issue. ### Expected Behavior When I send `POST /api/v1/chat/completions` with an explicit OpenAI-style `tools` array, only those caller-provided tools should be advertised/exposed to the model and used for tool calling. Server-side tools (`tool_ids`, `tool_servers`, builtin native tools) should not override the request payload when `tools` is explicitly provided. ### Actual Behavior `/api/v1/chat/completions` can ignore the caller-provided `tools` payload and replace it with server-resolved tools (including builtin native tools), causing: - tools to be advertised that the caller did not provide - tool calls to functions not present in the request `tools` ### Steps to Reproduce 1. Start Open WebUI from a fresh clone of `dev` (or latest) and configure any working OpenAI-compatible model. 2. Obtain an API token and confirm the model ID available in Open WebUI. 3. Send this request (replace placeholders): ```bash curl -X POST "http://localhost:3000/api/v1/chat/completions" \ -H "Authorization: Bearer <TOKEN>" \ -H "Content-Type: application/json" \ -d '{ "model": "<MODEL_ID>", "stream": false, "messages": [ {"role":"user","content":"What time is it right now? Use a tool if needed."} ], "params": {"function_calling":"native"}, "tools": [ { "type":"function", "function":{ "name":"only_allowed_tool", "description":"Dummy tool that should be the only available tool.", "parameters":{"type":"object","properties":{}} } } ] }' ``` 4. Observe that response/tool behavior may reference builtin/server tools (for example `get_current_timestamp`) even though request `tools` only contained `only_allowed_tool`. 5. (Optional stronger repro) Also pass `tool_ids` and confirm those server-side tools appear/are used instead of caller payload. ### Logs & Screenshots - As-is (overrides request and advertises built-in tools) <img width="522" height="467" alt="001 asis" src="https://github.com/user-attachments/assets/64571004-c12e-405b-96cb-2acd27277716" /> - To-be (properly fills user-requested tools - cursor) <img width="522" height="467" alt="002 tobe" src="https://github.com/user-attachments/assets/c1c3a5c7-aafd-4d2b-81a2-4a70e860a318" /> ### Additional Information Relevant configuration/assumptions for repro: - `params.function_calling` is set to `"native"` in request body. - Model capability `builtin_tools` defaults to enabled unless explicitly disabled in model metadata. - No special env overrides required to hit this bug. - Proposed fix: https://github.com/open-webui/open-webui/pull/21555 - Discussion: https://github.com/open-webui/open-webui/discussions/21556
GiteaMirror added the bug label 2026-04-25 09:15:08 -05:00
Author
Owner

@pr-validator-bot commented on GitHub (Feb 18, 2026):

⚠️ Missing Issue Title Prefix

@exxocism, your issue title is missing a prefix (e.g., bug:, feat:, docs:).

Please update your issue title to include one of the following prefixes:

  • bug: Bug report or error you've encountered
  • feat: Feature request or enhancement suggestion
  • docs: Documentation issue or improvement request
  • question: Question about usage or functionality
  • help: Request for help or support

Example: bug: Login fails when using special characters in password

<!-- gh-comment-id:3918783620 --> @pr-validator-bot commented on GitHub (Feb 18, 2026): # ⚠️ Missing Issue Title Prefix @exxocism, your issue title is missing a prefix (e.g., `bug:`, `feat:`, `docs:`). Please update your issue title to include one of the following prefixes: - **bug**: Bug report or error you've encountered - **feat**: Feature request or enhancement suggestion - **docs**: Documentation issue or improvement request - **question**: Question about usage or functionality - **help**: Request for help or support Example: `bug: Login fails when using special characters in password`
Author
Owner

@tjbck commented on GitHub (Feb 23, 2026):

Good catch, addressed in dev!

<!-- gh-comment-id:3941951448 --> @tjbck commented on GitHub (Feb 23, 2026): Good catch, addressed in dev!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/open-webui#35045