From f1c33c4d1c2c9253b1e2b7172e411f25357887c8 Mon Sep 17 00:00:00 2001 From: mateo-berri <277851410+mateo-berri@users.noreply.github.com> Date: Wed, 27 May 2026 00:45:29 +0000 Subject: [PATCH] fix(mcp): set sequence_number on mcp_call output_item.done event create_mcp_call_events relied on OutputItemDoneEvent's default sequence_number, which was previously 1 but is now 0. Pass an explicit value so the event matches the streaming sequence order emitted by the surrounding MCP call events. --- litellm/responses/mcp/mcp_streaming_iterator.py | 1 + 1 file changed, 1 insertion(+) diff --git a/litellm/responses/mcp/mcp_streaming_iterator.py b/litellm/responses/mcp/mcp_streaming_iterator.py index 42c46dff47c..246caa584cd 100644 --- a/litellm/responses/mcp/mcp_streaming_iterator.py +++ b/litellm/responses/mcp/mcp_streaming_iterator.py @@ -218,6 +218,7 @@ def create_mcp_call_events( output_item_done_event = OutputItemDoneEvent( type=ResponsesAPIStreamEvents.OUTPUT_ITEM_DONE, output_index=0, + sequence_number=sequence_start + 4, item=BaseLiteLLMOpenAIResponseObject( **{ "id": item_id,