Skip to content

refactor(mcp): remove redundant type field from Content implementatio… #1

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

Merged
merged 1 commit into from
Mar 3, 2025

Conversation

pascalconfluent
Copy link
Owner

…ns (modelcontextprotocol#27)

  • 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.
  • Add default implementation that returns the appropriate type string based on the implementing class (text, image, or resource)
  • Added comprehensive unit tests for McpSchema to validate serialization/deserialization behavior of all schema components.
  • Add deserialization tests for all content types
  • Add json-unit-assertj for flexible JSON testing - ignores array order and extra array items, reducing test brittleness while maintaining functional validation.

Resolves modelcontextprotocol#26
Resolve spring-projects/spring-ai#2350

…ns (#27)

- 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.
- Add default implementation that returns the appropriate type string based on the implementing class (text, image, or resource)
- Added comprehensive unit tests for McpSchema to validate serialization/deserialization behavior of all schema components.
- Add deserialization tests for all content types
- Add json-unit-assertj for flexible JSON testing -  ignores array order and extra array items, reducing test brittleness while
maintaining functional validation.

Resolves #26
Resolve spring-projects/spring-ai#2350

Signed-off-by: Christian Tzolov <christian.tzolov@broadcom.com>
@pascalconfluent pascalconfluent merged commit 600f10e into pascalconfluent:main Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve MchSchema JSON consistency Duplicate "type" field in JSON output of McpSchema.TextContent
2 participants