Merge pull request #21535 from BerriAI/fix/mypy-mcp-user-permissions-type-errors

fix(mypy): resolve type errors from MCP user permissions commit
This commit is contained in:
jquinter
2026-02-19 02:18:58 -03:00
committed by GitHub
2 changed files with 3 additions and 3 deletions
@@ -1,4 +1,4 @@
from typing import TYPE_CHECKING
from typing import TYPE_CHECKING, Any, Dict, cast
from litellm.types.guardrails import SupportedGuardrailIntegrations
@@ -14,7 +14,7 @@ def initialize_guardrail(litellm_params: "LitellmParams", guardrail: "Guardrail"
# Default to always-on. Only disable if the user explicitly sets default_on: false.
# We check the raw guardrail dict because LitellmParams normalizes None → False,
# making it impossible to distinguish "not set" from "explicitly false" via litellm_params.
_raw_default_on = guardrail.get("litellm_params", {}).get("default_on")
_raw_default_on = cast(Dict[str, Any], guardrail).get("litellm_params", {}).get("default_on")
_default_on = False if _raw_default_on is False else True
_callback = MCPEndUserPermissionGuardrail(
@@ -1349,7 +1349,7 @@ class LiteLLMCompletionResponsesConfig:
result.append(tool) # type: ignore
continue
if tool.get("type") == "function":
fn = tool.get("function") or {}
fn: Dict[str, Any] = cast(Dict[str, Any], tool.get("function") or {})
parameters = dict(fn.get("parameters", {}) or {})
if not parameters or "type" not in parameters:
parameters["type"] = "object"