From 635df4efbcafef509202b1e2aebdac013d0c6400 Mon Sep 17 00:00:00 2001 From: Philipp Temminghoff Date: Sat, 30 Nov 2024 07:02:03 +0100 Subject: [PATCH] chore: handle_set_level fix --- src/llmling/server/server.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/llmling/server/server.py b/src/llmling/server/server.py index 2172d05..c3504b7 100644 --- a/src/llmling/server/server.py +++ b/src/llmling/server/server.py @@ -103,7 +103,7 @@ def _setup_handlers(self) -> None: @self.server.set_logging_level() async def handle_set_level(level: mcp.LoggingLevel) -> None: """Handle logging level changes.""" - level_map = { + level_map: dict[mcp.LoggingLevel, int] = { "debug": logging.DEBUG, "info": logging.INFO, "notice": logging.INFO, @@ -117,7 +117,11 @@ async def handle_set_level(level: mcp.LoggingLevel) -> None: python_level = level_map[level] logger.setLevel(python_level) data = f"Log level set to {level}" - await self.current_session.send_log_message(data=data, logger=self.name) + await self.current_session.send_log_message( + level, + data=data, + logger=self.name, + ) except Exception as exc: error = mcp.McpError("Error setting log level") error.error = mcp.ErrorData(code=INTERNAL_ERROR, message=str(exc))