MCPcopy Index your code
hub / github.com/modelcontextprotocol/python-sdk / test_tool_with_log

Function test_tool_with_log

tests/client/test_logging_callback.py:36–41  ·  view source on GitHub ↗

Send a log notification to the client.

(
        message: str, level: Literal["debug", "info", "warning", "error"], logger: str, ctx: Context
    )

Source from the content-addressed store, hash-verified

34 # Create a function that can send a log notification
35 @server.tool("test_tool_with_log")
36 async def test_tool_with_log(
37 message: str, level: Literal["debug", "info", "warning", "error"], logger: str, ctx: Context
38 ) -> bool:
39 """Send a log notification to the client."""
40 await ctx.log(level=level, data=message, logger_name=logger) # pyright: ignore[reportDeprecated]
41 return True
42
43 @server.tool("test_tool_with_log_dict")
44 async def test_tool_with_log_dict(

Callers

nothing calls this directly

Calls 1

logMethod · 0.45

Tested by

no test coverage detected