From e8090028f3718373a09e7ecfd9087e59523c5b0d Mon Sep 17 00:00:00 2001 From: Tin Chi Lo Date: Mon, 13 Jul 2026 16:14:54 -0700 Subject: [PATCH] style(mcp): unquote annotations and use PEP 604 unions in the faults package --- litellm/proxy/_experimental/mcp_server/faults/classify.py | 2 +- .../proxy/_experimental/mcp_server/faults/render_oauth.py | 2 +- litellm/proxy/_experimental/mcp_server/faults/types.py | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) 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):