modelcontextprotocol / modelcontextprotocol/csharp-sdk
Cancellation support via CancellationToken's fails
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 4.5k
- Forks
- 814
- Avg merge
- 9d 19h
- Merged PRs (30d)
- 4
Description
Describe the bug
On a tool call the client does take a CancellationToken however it seems to just abort the http request and not send a cancellation notification. The server side tool calls are shown taking CancellationToken's but I don't see what ever triggers them in that normal tool flow.
The client should send a cancel notification when the cancel token is used, and the server should trigger the tool cancel token both if it gets the cancel notification or if the connection drops.
working on a PR to do so.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing cancellation through the client tool-call flow and the server-side tool-call handling described in the issue. Verify that cancelling the client token sends a cancellation notification, and that the server cancels the tool token for both that notification and a dropped connection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- api, backend-api-design
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100