Skip to content

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]

fix(mypy): fix validate_tool_name return type signatures (#20184)

shin-bot-litellm65fb18b568ab
diff --git a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
index 5ae5b610805..d763b8fb644 100644
--- a/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
+++ b/litellm/proxy/_experimental/mcp_server/mcp_server_manager.py
@@ -70,16 +70,14 @@ try:
validate_tool_name,
)
except ImportError:
- from typing import Any
+ from pydantic import BaseModel
SEP_986_URL = "https://github.com/modelcontextprotocol/protocol/blob/main/proposals/0001-tool-name-validation.md"
- def validate_tool_name(name: str) -> Any:
- from pydantic import BaseModel
-
- class ToolNameValidationResult(BaseModel):
- is_valid: bool = True
- warnings: list = []
+ class ToolNameValidationResult(BaseModel):
+ is_valid: bool = True
+ warnings: list = []
+ def validate_tool_name(name: str) -> ToolNameValidationResult:
return ToolNameValidationResult()
diff --git a/litellm/proxy/management_endpoints/mcp_management_endpoints.py b/litellm/proxy/management_endpoints/mcp_management_endpoints.py
index 3ba841f07fd..6225f39626d 100644
--- a/litellm/proxy/management_endpoints/mcp_management_endpoints.py
+++ b/litellm/proxy/management_endpoints/mcp_management_endpoints.py
@@ -63,15 +63,13 @@ if MCP_AVAILABLE:
validate_tool_name,
)
except ImportError:
- from typing import Any
+ from pydantic import BaseModel
- def validate_tool_name(name: str) -> Any:
- from pydantic import BaseModel
-
- class ToolNameValidationResult(BaseModel):
- is_valid: bool = True
- warnings: list = []
+ class ToolNameValidationResult(BaseModel):
+ is_valid: bool = True
+ warnings: list = []
+ def validate_tool_name(name: str) -> ToolNameValidationResult:
return ToolNameValidationResult()
from litellm.proxy._experimental.mcp_server.db import (