From d52f98b25854f090904cbe67adb5f93b7b5c0551 Mon Sep 17 00:00:00 2001 From: Thomas Chardonnens <61554870+tchardonnens@users.noreply.github.com> Date: Thu, 26 Nov 2026 18:03:34 +0100 Subject: [PATCH] fix(client): use lazy formatting for per-message debug logs in streamable HTTP --- src/mcp/client/streamable_http.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mcp/client/streamable_http.py b/src/mcp/client/streamable_http.py index 053f1f10a9..df0e6b2d02 100644 --- a/src/mcp/client/streamable_http.py +++ b/src/mcp/client/streamable_http.py @@ -188,7 +188,7 @@ async def _handle_sse_event( return False try: message = jsonrpc_message_adapter.validate_json(sse.data, by_name=False) - logger.debug(f"SSE message: {message}") + logger.debug("SSE message: %s", message) # If this is a response and we have original_request_id, replace it if original_request_id is not None and isinstance(message, JSONRPCResponse | JSONRPCError): @@ -632,7 +632,7 @@ async def _handle_message(session_message: SessionMessage) -> None: # Check if this is a resumption request is_resumption = bool(metadata and metadata.resumption_token) - logger.debug(f"Sending client message: {message}") + logger.debug("Sending client message: %s", message) # Handle initialized notification if self._is_initialized_notification(message):