Title: Cancelling a Call Tool Request from Client · Issue #1410 · modelcontextprotocol/python-sdk · GitHub
Open Graph Title: Cancelling a Call Tool Request from Client · Issue #1410 · modelcontextprotocol/python-sdk
X Title: Cancelling a Call Tool Request from Client · Issue #1410 · modelcontextprotocol/python-sdk
Description: Question Hey Team, I have a question regarding cancelling the tool call from client when the MCP server is created from FastMCP class. I see the test - test_cancel_handling but this one uses low level server. My question is specifically ...
Open Graph Description: Question Hey Team, I have a question regarding cancelling the tool call from client when the MCP server is created from FastMCP class. I see the test - test_cancel_handling but this one uses low le...
X Description: Question Hey Team, I have a question regarding cancelling the tool call from client when the MCP server is created from FastMCP class. I see the test - test_cancel_handling but this one uses low le...
Opengraph URL: https://github.com/modelcontextprotocol/python-sdk/issues/1410
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Cancelling a Call Tool Request from Client","articleBody":"### Question\n\nHey Team,\nI have a question regarding cancelling the tool call from client when the MCP server is created from `FastMCP` class. \n\nI see the test - [test_cancel_handling](https://github.com/modelcontextprotocol/python-sdk/blob/main/tests/server/test_cancel_handling.py) but this one uses low level server.\n\nMy question is specifically on how we can get the `request_id` which the client needs for cancelling the call tool request on server. \n```\nawait client.send_notification(\n ClientNotification(\n CancelledNotification(\n params=CancelledNotificationParams(\n requestId={request_id},\n reason=\"Reson\",\n ),\n )\n )\n)\n```\n\nDo we have to get the request id from `call_tool` request? like below?\n\n```py\n request_id = None\n mcp = FastMCP(\n name=\"Simple gRPC Server\",\n )\n @mcp.tool()\n def get_temperature(city: str, ctx: Context[ServerSession, None]) -\u003e float:\n # fetching request id from context \n request_id = ctx.request_context.request_id\n return 22.5\n \n```\n\nOr is there another way?\n\n### Additional Context\n\n_No response_","author":{"url":"https://github.com/asheshvidyut","@type":"Person","name":"asheshvidyut"},"datePublished":"2025-09-29T06:37:53.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":1},"url":"https://github.com/1410/python-sdk/issues/1410"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:83a2a00b-725e-eab3-dac7-d0160b72b31b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8A26:1C1025:BB8116:FBB53C:6A5B5640 |
| html-safe-nonce | 18de1ad6df26932e4e9ab2f186f79b221940ec1bcd20e73d4bbbcc5573d325eb |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4QTI2OjFDMTAyNTpCQjgxMTY6RkJCNTNDOjZBNUI1NjQwIiwidmlzaXRvcl9pZCI6IjE5NTgxNjc2ODA0MjQ1NjQyODgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 72fabde1a8b7330c8af9bb2e487a33d049eef4049e05279f51676e6e43ad0570 |
| hovercard-subject-tag | issue:3463474605 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/modelcontextprotocol/python-sdk/1410/issue_layout |
| twitter:image | https://opengraph.githubassets.com/700553b3001ab1459cb743a5b8f6b04f62e2f2bdbcce95a65161847b104c70b3/modelcontextprotocol/python-sdk/issues/1410 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/700553b3001ab1459cb743a5b8f6b04f62e2f2bdbcce95a65161847b104c70b3/modelcontextprotocol/python-sdk/issues/1410 |
| og:image:alt | Question Hey Team, I have a question regarding cancelling the tool call from client when the MCP server is created from FastMCP class. I see the test - test_cancel_handling but this one uses low le... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | asheshvidyut |
| hostname | github.com |
| expected-hostname | github.com |
| None | 5290d7e14309ad1e76106a9c4237bd1041517e83ea182c8ab756752cb0c6940b |
| turbo-cache-control | no-preview |
| go-import | github.com/modelcontextprotocol/python-sdk git https://github.com/modelcontextprotocol/python-sdk.git |
| octolytics-dimension-user_id | 182288589 |
| octolytics-dimension-user_login | modelcontextprotocol |
| octolytics-dimension-repository_id | 862584018 |
| octolytics-dimension-repository_nwo | modelcontextprotocol/python-sdk |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 862584018 |
| octolytics-dimension-repository_network_root_nwo | modelcontextprotocol/python-sdk |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9c975978430e9ad293956f2bbdaf153b1bd84a99 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width