Skip to content

Conversation

@LucaButBoring
Copy link
Contributor

Moves message content types into a union and uses that throughout the codebase. Suggested by @Kludex in #725.

Motivation and Context

Simplifies code, makes for fewer places to update when new content types are introduced in the future.

How Has This Been Tested?

Unit tests

Breaking Changes

None

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


from mcp.types import AudioContent, EmbeddedResource, ImageContent, TextContent

CONTENT_TYPES = TextContent | ImageContent | AudioContent | EmbeddedResource
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will accept this PR as I don't think anyone is importing this directly.

@Kludex Kludex merged commit d69b290 into modelcontextprotocol:main Jun 12, 2025
24 of 27 checks passed
@LucaButBoring LucaButBoring deleted the chore/message-content-union branch June 12, 2025 16:30
saqadri pushed a commit to saqadri/stdio-fixes that referenced this pull request Aug 6, 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.

2 participants