-
Notifications
You must be signed in to change notification settings - Fork 550
feat: Add _meta
field to classes across MCPSchema
#368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pantanurag555 , thank you for the PR,
I've started reviewing it and put some comments. Also making the Resource not implement a ResourceContent is suspicious?
But since you've made a lot unnecessary formatting changes it is very hard to review.
Can you please revert all non-essential changes (like formatting) to make it a more readable.
cheers
mcp/src/test/java/io/modelcontextprotocol/spec/McpSchemaTests.java
Outdated
Show resolved
Hide resolved
Addressed the feedback. It should be easier to understand when taking a look at the diff. The PR needs to be rebased due to other changes on the same files (which can be quite laborious). Waiting for any additional feedback before attempting the final rebase. |
I’m very glad to see that active work is already being done on supporting the Even though it can't yet be said with certainty whether it will be used for that purpose in the future, support for it in the SDK will at least create the possibility for it. |
- Add _meta field to all MCP schema records for extensible metadata support - Introduce Result and Notification sealed interfaces for better type organization - Update Request interface to include SubscribeRequest and UnsubscribeRequest - Add backwards-compatible constructors for existing record types - Enhance test coverage for metadata field functionality Breaking change: Modifyibng the Request seald inteface is a breaking change.
Thank you @pantanurag555 |
Squashed and merged at 87cdaf8 |
Motivation and Context
_meta
field was added to multiple classes in the schema to make it easy to pass metadata when communicating between an MCP client and server. Relevant spec PR: modelcontextprotocol/modelcontextprotocol#710This PR adds
_meta
field across all relevant classes in MCPSchema. It also creates new interfaces for Result and Notifications to ensure that this field is added to any future classes created that implement these interfaces.Currently MCPSchema in java SDK is missing classes for different list requests (ListResourcesRequest, ListToolsRequest etc-) opting to create the JSONRPCRequest and send it directly to the server instead. Similarly the class for RootsListChangedNotification is missing as well. Therefore, it is not possible to add
_meta
field to these exchanges between the server and client as of now. Relevant classes should be added to the java SDK in the future to maintain parity with the specification. This PR does not address this issue.Resolves #344
How Has This Been Tested?
Added relevant unit tests for all classes.
Breaking Changes
None. Added relevant backward compatible constructors to ensure
Types of changes
Checklist