Skip to content

fix: model content annotations as nested objects #242

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

LucaButBoring
Copy link

@LucaButBoring LucaButBoring commented May 16, 2025

Updates all Content types to represent annotations as nested objects instead of directly on the content itself. The existing ctors have been moved to deprecated shim ctors for backwards-compat.

This brings the implementation in line with the content types as modeled by the specification. An integration test has been added to ensure this doesn't drift in the future.

Motivation and Context

Content annotations have been incorrect for at least six months. The integration test added in this PR fails without the related schema changes.

How Has This Been Tested?

Newly-implemented integration test, leveraging the appropriate tool from everything.

Breaking Changes

None; the old constructor has been maintained for backwards-compatibility purposes. The old auto-generated record properties (.audience() and .priority()) have also been maintained.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

Additional context

Updates all Content types to represent annotations as nested objects
instead of directly on the content itself. The existing ctors have
been moved to deprecated shim ctors for backwards-compat.

This brings the implementation in line with the content types as
modeled by the specification. An integration test has been added
to ensure this doesn't drift in the future.

https://github.com/modelcontextprotocol/modelcontextprotocol/blob/c87a0da6d8c2436d56a6398023c80b0562224454/schema/2025-03-26/schema.json#L1970-L1973
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.

1 participant