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: lint
Yuta Saito0db6229b63c2
diff --git a/litellm/main.py b/litellm/main.pyindex 8fce4793ead..e32d05a81d0 100644--- a/litellm/main.py+++ b/litellm/main.py@@ -28,6 +28,7 @@ from typing import (Callable,Coroutine,Dict,+ Iterable,List,Literal,Mapping,@@ -1102,11 +1103,15 @@ def completion( # type: ignore # noqa: PLR0915from litellm.responses.mcp.litellm_proxy_mcp_handler import (LiteLLM_Proxy_MCP_Handler,)+ from litellm.types.llms.openai import ToolParam# Check if MCP tools are present (following responses pattern)- if LiteLLM_Proxy_MCP_Handler._should_use_litellm_mcp_gateway(tools=tools):+ # Cast tools to Optional[Iterable[ToolParam]] for type checking+ tools_for_mcp = cast(Optional[Iterable[ToolParam]], tools)+ if LiteLLM_Proxy_MCP_Handler._should_use_litellm_mcp_gateway(tools=tools_for_mcp):# Return coroutine - acompletion will await it- return acompletion_with_mcp(+ # completion() can return a coroutine when MCP tools are present, which acompletion() awaits+ return acompletion_with_mcp( # type: ignore[return-value]model=model,messages=messages,functions=functions,