Pass request _meta to request handlers extra param #328
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Motivation and Context
The MCP client sends a progress token when calling tools, but there's currently no way for the server (in this SDK) to retrieve this progress token. While the client will receive the progress notifications, it won't associate them with the tool calls and thus it can't properly report on progress.
How Has This Been Tested?
In the inspector, of course, and my chat MCP client (SSE server).
Here's the setup, roughly:
Breaking Changes
None.
Types of changes
Checklist
Additional context
This is the smallest possible way to implement the functionality in the SDK, but I'm not convinced on the ergonomics as a user.
I'm open to hear your ideas:
sendProgress(progress: number, total?:number)
in theextra
params instead? The Python SDK has areport_progress
that it passes to the request context.progressToken
make sense, actually? There's already arelatedRequestId
passed through bysendNotification
—maybe that should be used instead of a separate progress token?