Fix bug: request_meta is not available in server.request_context#104
Closed
phact wants to merge 2 commits into
Closed
Fix bug: request_meta is not available in server.request_context#104phact wants to merge 2 commits into
phact wants to merge 2 commits into
Conversation
Fixes modelcontextprotocol#103 Fix the issue where `server.request_context.meta` does not include the `progressToken`. * **Extract `_meta` field**: Extract the `_meta` field from request parameters and assign it to `message.request_meta` in `src/mcp/server/__init__.py`. * **Update `RequestContext`**: Update `RequestContext` instantiation to include `progressToken` in `src/mcp/server/__init__.py`. * **Allow extra fields**: Update `RequestParams` instantiation to include `model_config = ConfigDict(extra="allow")` in `src/mcp/types.py`. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/modelcontextprotocol/python-sdk/issues/103?shareId=XXXX-XXXX-XXXX-XXXX).
Author
|
@dsp-ant here's a quick take on this issue (works in my test setup) |
Member
|
Thank you for this. This helped me figuring out a fix. I think my fix in #108 is more general and we should probably go down that route. I'll close out this PR. Thank you so much for the bug report and the attempted fix! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Fixes #103
Fix the issue where
server.request_context.metadoes not include theprogressToken._metafield: Extract the_metafield from request parameters and assign it tomessage.request_metainsrc/mcp/server/__init__.py.RequestContext: UpdateRequestContextinstantiation to includeprogressTokeninsrc/mcp/server/__init__.py.RequestParamsinstantiation to includemodel_config = ConfigDict(extra="allow")insrc/mcp/types.py.For more details, open the Copilot Workspace session.