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
16
examples/snippets/clients/cancellation.py
Normal file
16
examples/snippets/clients/cancellation.py
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import mcp.types as types
|
||||
from mcp import ClientSession
|
||||
|
||||
|
||||
async def cancel_request(session: ClientSession) -> None:
|
||||
"""Send a cancellation notification for a previously-issued request."""
|
||||
await session.send_notification(
|
||||
types.ClientNotification(
|
||||
types.CancelledNotification(
|
||||
params=types.CancelledNotificationParams(
|
||||
requestId="request-id-to-cancel",
|
||||
reason="User navigated away",
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
Loading…
Reference in a new issue