Skip to content

Commit

Permalink
chore: handle_set_level fix
Browse files Browse the repository at this point in the history
  • Loading branch information
phil65 committed Nov 30, 2024
1 parent 0a996ea commit 635df4e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/llmling/server/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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))
Expand Down

0 comments on commit 635df4e

Please sign in to comment.