Skip to content

docs: explain FastMCP request IDs for cancellation#2226

Open
lavish0000 wants to merge 2 commits intomodelcontextprotocol:mainfrom
lavish0000:docs/fastmcp-cancel-request-id-1410
Open

docs: explain FastMCP request IDs for cancellation#2226
lavish0000 wants to merge 2 commits intomodelcontextprotocol:mainfrom
lavish0000:docs/fastmcp-cancel-request-id-1410

Conversation

@lavish0000
Copy link

Closes #1410

Summary:

  • document that ctx.request_id and ctx.request_context.request_id expose the current FastMCP request ID inside a tool
  • clarify that notifications/cancelled uses that same JSON-RPC request ID for normal in-flight requests such as tools/call
  • note the current limitation that high-level client helpers do not expose request IDs directly, and point readers toward task-based cancellation for explicit client-side control

Testing:

  • python3 -m uv run pytest tests/shared/test_session.py -k test_request_cancellation

@maxisbey maxisbey added documentation Improvements or additions to documentation P3 Nice to haves, rare edge cases labels Mar 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation P3 Nice to haves, rare edge cases

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cancelling a Call Tool Request from Client

2 participants