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]

style(mcp): unquote annotations and use PEP 604 unions in the faults package

Tin Chi Loe8090028f371
diff --git a/litellm/proxy/_experimental/mcp_server/faults/classify.py b/litellm/proxy/_experimental/mcp_server/faults/classify.py
index a816b8e2a96..cf4d022d33b 100644
--- a/litellm/proxy/_experimental/mcp_server/faults/classify.py
+++ b/litellm/proxy/_experimental/mcp_server/faults/classify.py
@@ -35,7 +35,7 @@ def _safe_json(response: httpx.Response) -> object:
return None
-def _bounded_field(value: object) -> "str | None":
+def _bounded_field(value: object) -> str | None:
if not isinstance(value, str) or not value:
return None
return value[:MAX_WIRE_FIELD_CHARS]
diff --git a/litellm/proxy/_experimental/mcp_server/faults/render_oauth.py b/litellm/proxy/_experimental/mcp_server/faults/render_oauth.py
index 5fc82819dc0..4856e6fbe52 100644
--- a/litellm/proxy/_experimental/mcp_server/faults/render_oauth.py
+++ b/litellm/proxy/_experimental/mcp_server/faults/render_oauth.py
@@ -58,7 +58,7 @@ def render_token_fault(fault: UpstreamOAuthFault) -> JSONResponse:
assert_never(fault.tag)
-def dcr_fault_detail(fault: UpstreamOAuthFault) -> "tuple[int, str]":
+def dcr_fault_detail(fault: UpstreamOAuthFault) -> tuple[int, str]:
"""Status and detail string for a registration fault, raised as HTTPException by the caller.
RFC 7591 §3.2.2 defines registration errors as 400, so a contract-conformant rejection is 400
regardless of the status the upstream chose; everything else is a 502 upstream fault."""
diff --git a/litellm/proxy/_experimental/mcp_server/faults/types.py b/litellm/proxy/_experimental/mcp_server/faults/types.py
index 2a200323024..8cc291459a0 100644
--- a/litellm/proxy/_experimental/mcp_server/faults/types.py
+++ b/litellm/proxy/_experimental/mcp_server/faults/types.py
@@ -7,7 +7,7 @@ when an upstream's status and error code are relayed independently.
from __future__ import annotations
-from typing import Literal, Optional, TypeAlias
+from typing import Literal, TypeAlias
from pydantic import BaseModel, ConfigDict
@@ -33,8 +33,8 @@ class CallerRejected(BaseModel):
model_config = ConfigDict(frozen=True)
tag: Literal["caller_rejected"] = "caller_rejected"
code: str
- description: Optional[str] = None
- error_uri: Optional[str] = None
+ description: str | None = None
+ error_uri: str | None = None
class GatewayCredentialsRejected(BaseModel):