Skip to content

docs: explain FastMCP request IDs for cancellation#2226

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

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
Copy Markdown

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
@maxisbey
Copy link
Copy Markdown
Contributor

Thanks for the PR! Per our CONTRIBUTING.md, PRs require a corresponding issue with the ready for work label so we can agree on scope before reviewing code. Closing for now — please open an issue first and re-submit once it's triaged.

AI Disclaimer

@maxisbey maxisbey closed this Mar 24, 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