8 views
-/https://github.com/berriai/litellm/issues/31910
GitHub Β· issue

#31910 [Bug]: MCP auto-execute + stream:true leaks intermediate tool-call turn (finish_reason:"tool_calls") into client stream β€” chat UIs render empty messages

  • State: open
  • Author: @grahamton
  • Labels: llm translation

### Check for existing issues

- [x] I have searched the existing issues and checked that my issue is not a duplicate.

### What happened?

When the proxy auto-executes MCP tools (`require_approval: "never"`, e.g. tools attached to a model/agent definition) with `stream: true`, the client receives the **intermediate tool-call turn** in the SSE stream before the final answer:

1. Phase 1: chunks of the model's first turn β€” including `delta.tool_calls` and a chunk with `finish_reason: "tool_calls"` β€” are yielded straight to the client. 2. The proxy then executes the MCP tools server-side. 3. Phase 2: the follow-up model turn (the actual answer) streams afterward, ending with `finish_reason: "stop"`.

The client effectively receives **two complete assistant messages in one stream**, with a `finish_reason` in the middle. Standard OpenAI-compatible clients treat the first `finish_reason` as end-of-message. Open WebUI, for example, sees `finish_reason: "tool_calls"` referencing a tool call it never sent, ends the assistant message there, and discards the Phase 2 content β€” the user sees a **completely empty reply** even though the proxy did all the work and produced a correct answer.

Non…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (1 events)
#0 of 0 Β· 31d18h59m59s ago β€” entered Β· #import:https:::github.com:berriai:litellm post #1868
#31910 requires changes across streaming orchestration, tool-execution sequencing, protocol compatibility, and regression coverage; #27197 is a localized dashboard event-handler fix with comparatively low integration risk.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search