-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Duplicate "type" field in JSON output of McpSchema.TextContent #2350
Closed
deemkeen opened this issue
Feb 28, 2025
· 2 comments
· Fixed by modelcontextprotocol/java-sdk#27 or pascalconfluent/mcp-java-sdk#1
Closed
Duplicate "type" field in JSON output of McpSchema.TextContent #2350
deemkeen opened this issue
Feb 28, 2025
· 2 comments
· Fixed by modelcontextprotocol/java-sdk#27 or pascalconfluent/mcp-java-sdk#1
Comments
tzolov
added a commit
to modelcontextprotocol/java-sdk
that referenced
this issue
Mar 1, 2025
- The type field and associated methods were redundant in Content implementations (TextContent, ImageContent, EmbeddedResource) as the type information is already handled by Jackson's polymorphic type handling via @JsonSubTypes annotation. - Added comprehensive unit tests for McpSchema to validate serialization/deserialization behavior of all schema components. Resolves #26 Resolve spring-projects/spring-ai#2350 Signed-off-by: Christian Tzolov <[email protected]>
Thanks for catching this @deemkeen |
Great, thank you! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description
When converting an instance of
McpSchema.TextContent
to JSON using Jackson'sObjectMapper
, the resulting JSON contains a duplicate "type" field. This is incorrect and could lead to parsing issues or unexpected behavior in systems consuming this JSON.Steps to Reproduce
McpSchema.TextContent
ObjectMapper
Expected Behavior
The JSON output should have only one "type" field:
Actual Behavior
The JSON output contains a duplicate "type" field:
Possible Cause
This is likely due to a field and a getter method both being annotated with
@JsonProperty("type")
in theMcpSchema.TextContent
class, or the field might be defined twice in the class hierarchy.Environment
The text was updated successfully, but these errors were encountered: