docs: add snippet verification for docs/ pages (#2115)
This commit is contained in:
parent
cfbbd7d71a
commit
1ef124e4a8
1 changed files with 446 additions and 43 deletions
13
examples/snippets/clients/logging_client.py
Normal file
13
examples/snippets/clients/logging_client.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
from mcp import ClientSession, types
|
||||
|
||||
|
||||
async def handle_log(params: types.LoggingMessageNotificationParams) -> None:
|
||||
"""Handle log messages from the server."""
|
||||
print(f"[{params.level}] {params.data}")
|
||||
|
||||
|
||||
session = ClientSession(
|
||||
read_stream,
|
||||
write_stream,
|
||||
logging_callback=handle_log,
|
||||
)
|
||||
Loading…
Reference in a new issue