The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix: support ResponseFunctionToolCall in follow-up input
Yuta Saito864b61b43327
diff --git a/litellm/responses/mcp/litellm_proxy_mcp_handler.py b/litellm/responses/mcp/litellm_proxy_mcp_handler.pyindex 40f185a27b8..2a637893836 100644--- a/litellm/responses/mcp/litellm_proxy_mcp_handler.py+++ b/litellm/responses/mcp/litellm_proxy_mcp_handler.py@@ -638,6 +638,11 @@ class LiteLLM_Proxy_MCP_Handler:function_calls: List[Dict[str, Any]] = []for output_item in response.output:+ if not isinstance(output_item, dict) and hasattr(+ output_item, "model_dump"+ ):+ output_item = output_item.model_dump()+if isinstance(output_item, dict):if output_item.get("type") == "function_call":call_id = output_item.get("call_id") or output_item.get("id")diff --git a/tests/test_litellm/responses/mcp/test_litellm_proxy_mcp_handler.py b/tests/test_litellm/responses/mcp/test_litellm_proxy_mcp_handler.pyindex ab84294b35a..b632e72f567 100644--- a/tests/test_litellm/responses/mcp/test_litellm_proxy_mcp_handler.py+++ b/tests/test_litellm/responses/mcp/test_litellm_proxy_mcp_handler.py@@ -8,6 +8,7 @@ from litellm.responses.mcp.litellm_proxy_mcp_handler import (LiteLLM_Proxy_MCP_Handler,)from litellm.types.utils import ModelResponse+from litellm.types.responses.main import OutputFunctionToolCallclass _DummyMCPResult:@@ -168,6 +169,36 @@ def test_transform_mcp_tools_to_openai_uses_chat_format(monkeypatch):assert captured["responses"] == ["tool"]+def test_create_follow_up_input_handles_response_function_tool_call():+ response = types.SimpleNamespace(+ output=[+ OutputFunctionToolCall(+ id="id",+ type="function_call",+ call_id="call-1",+ name="foo",+ arguments="{}",+ status="completed",+ )+ ]+ )++ follow_up = LiteLLM_Proxy_MCP_Handler._create_follow_up_input(+ response=response,+ tool_results=[],+ original_input=None,+ )++ assert follow_up == [+ {+ "type": "function_call",+ "call_id": "call-1",+ "name": "foo",+ "arguments": "{}",+ }+ ]++@pytest.mark.asyncioasync def test_execute_tool_calls_strips_server_prefix(monkeypatch):call_tool_mock = _setup_mcp_call_environment(monkeypatch)