From 055f6befca9636449c0d0c21ad5f48313c21c070 Mon Sep 17 00:00:00 2001 From: Yucheng Zhu Date: Tue, 11 Aug 2026 17:55:12 -0700 Subject: [PATCH] refactor(redaction): type the MCP metadata helper as StandardLoggingMetadata --- litellm/litellm_core_utils/redact_messages.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/litellm/litellm_core_utils/redact_messages.py b/litellm/litellm_core_utils/redact_messages.py index 29cfb3134c2..51785e85e2e 100644 --- a/litellm/litellm_core_utils/redact_messages.py +++ b/litellm/litellm_core_utils/redact_messages.py @@ -22,7 +22,7 @@ from litellm.llms.vertex_ai.common_utils import ( redact_vertex_ai_metadata_from_logged_object, ) from litellm.secret_managers.main import str_to_bool -from litellm.types.utils import StandardCallbackDynamicParams +from litellm.types.utils import StandardCallbackDynamicParams, StandardLoggingMetadata if TYPE_CHECKING: from litellm.litellm_core_utils.litellm_logging import ( @@ -158,7 +158,9 @@ def _redact_responses_api_output_dict(output_items, redacted_str: str): output_item["arguments"] = redacted_str -def redacted_mcp_tool_call_metadata(metadata: object, redacted_str: str) -> object: +def redacted_mcp_tool_call_metadata( + metadata: StandardLoggingMetadata | None, redacted_str: str +) -> StandardLoggingMetadata | None: """MCP tool arguments and results are user content, and they ride in `metadata.mcp_tool_call_metadata` rather than in `messages` / `response`, so every integration that logs metadata exports them unless redacted here.