Skip to content

Comments

Fix Resource::Contents#to_h to use correct property names per MCP spec#235

Merged
koic merged 1 commit intomodelcontextprotocol:mainfrom
koic:fix_property_field_names_in_resource_contents
Feb 20, 2026
Merged

Fix Resource::Contents#to_h to use correct property names per MCP spec#235
koic merged 1 commit intomodelcontextprotocol:mainfrom
koic:fix_property_field_names_in_resource_contents

Conversation

@koic
Copy link
Member

@koic koic commented Feb 19, 2026

Motivation and Context

This PR fixes thr following fields with the MCP specification which requires:

  • Text resources use text and mimeType fields
  • Binary resources use blob (base64-encoded) and mimeType fields

https://modelcontextprotocol.io/specification/2025-11-25/server/resources#resource-contents

Fixes #234.

How Has This Been Tested?

Added a repro test to verify the fix and prevent regression.

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

This PR fixes thr following fields with the MCP specification which requires:

- Text resources use `text` and `mimeType` fields
- Binary resources use `blob` (base64-encoded) and `mimeType` fields

https://modelcontextprotocol.io/specification/2025-11-25/server/resources#resource-contents

Fixes modelcontextprotocol#234.
@koic koic force-pushed the fix_property_field_names_in_resource_contents branch from dd23efc to 08832c6 Compare February 19, 2026 04:50
@koic
Copy link
Member Author

koic commented Feb 20, 2026

@modelcontextprotocol/ruby-sdk If possible, this bug fix is planned to be included in the upcoming 0.7.1 release. Could you please review it when you have time?

Copy link
Member

@jonathanhefner jonathanhefner left a comment

Choose a reason for hiding this comment

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

Flagging that this is technically a breaking change, but I assume that is acceptable because it is 0.x version. 👍

@koic koic merged commit a05da39 into modelcontextprotocol:main Feb 20, 2026
10 checks passed
@koic koic deleted the fix_property_field_names_in_resource_contents branch February 20, 2026 02:51
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.

Resource::TextContents#to_h returns mime_type (snake_case) instead of mimeType (camelCase)

2 participants