feat: Add _meta
field to classes across MCPSchema
#368
+916
−626
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
_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