Yuki Minamiya
64219be2c8
Add annotations field to MCP::Resource and MCP::ResourceTemplate per MCP specification
...
## Motivation and Context
The MCP specification defines an optional `annotations` field on both the
`Resource` and `ResourceTemplate` types, but the Ruby SDK is the only official
SDK that does not wire it up — TypeScript, Python, and PHP all implement it.
https://modelcontextprotocol.io/specification/2025-11-25/server/resources#annotations
The `MCP::Annotations` class already exists; this commit connects it. The field
accepts an `MCP::Annotations` instance rather than a raw hash, for consistency
with other typed fields and to get `lastModified` key normalization for free.
## How Has This Been Tested?
Added tests in `test/mcp/resource_test.rb` and
`test/mcp/resource_template_test.rb`:
- `#to_h` omits `annotations` when nil
- `#to_h` includes `annotations` when present (also asserting that
`last_modified` is serialized as `lastModified`)
The full unit suite and RuboCop pass locally.
## Breaking Changes
None. `annotations:` is a new optional keyword argument defaulting to `nil`,
and it is omitted from `#to_h` output when not set.
2026-06-14 16:05:25 +09:00
..
client
Merge pull request #395 from koic/rfc8414_well_known_suffix
2026-06-13 20:23:10 +09:00
prompt
Add _meta field to resource, content, and result classes
2026-04-11 15:08:55 +09:00
resource
Add _meta field to resource, content, and result classes
2026-04-11 15:08:55 +09:00
server
Merge pull request #392 from koic/fallback_missing_protocol_version_in_streamable_http_transport
2026-06-14 00:15:55 +09:00
tool
Speed Up Tool::Schema Validation by 5x to 100x
2026-06-01 21:47:30 +09:00
annotations_test.rb
Replace assert_empty with assert_equal using explicit literals
2026-02-24 16:09:34 +09:00
cancellation_test.rb
Support notifications/cancelled per MCP specification
2026-05-03 04:02:22 +09:00
client_test.rb
Support W3C Trace Context Propagation via _meta per SEP-414
2026-06-12 14:36:24 +09:00
configuration_test.rb
feat: add opt-in tool output validation
2026-05-12 16:20:43 -04:00
content_test.rb
Add _meta field to resource, content, and result classes
2026-04-11 15:08:55 +09:00
icon_test.rb
Replace assert_empty with assert_equal using explicit literals
2026-02-24 16:09:34 +09:00
instrumentation_test.rb
Add around_request hook for request instrumentation
2026-04-11 13:54:47 +09:00
logging_message_notification_test.rb
Add logging support
2026-01-26 22:23:46 +09:00
methods_test.rb
Add roots/list and notifications/roots/list_changed support
2026-04-15 02:39:14 +09:00
progress_test.rb
Auto-set server.transport in Transport#initialize
2026-04-09 12:08:55 +09:00
prompt_test.rb
Fix Prompt#validate_arguments! crash when arguments are nil
2026-03-01 17:21:41 +09:00
resource_template_test.rb
Add annotations field to MCP::Resource and MCP::ResourceTemplate per MCP specification
2026-06-14 16:05:25 +09:00
resource_test.rb
Add annotations field to MCP::Resource and MCP::ResourceTemplate per MCP specification
2026-06-14 16:05:25 +09:00
server_cancellation_test.rb
Support notifications/cancelled per MCP specification
2026-05-03 04:02:22 +09:00
server_context_test.rb
Support server-to-client ping per MCP specification
2026-05-22 11:28:51 +09:00
server_elicitation_test.rb
Support notifications/cancelled per MCP specification
2026-05-03 04:02:22 +09:00
server_notification_test.rb
Auto-set server.transport in Transport#initialize
2026-04-09 12:08:55 +09:00
server_progress_test.rb
Auto-set server.transport in Transport#initialize
2026-04-09 12:08:55 +09:00
server_roots_test.rb
Add roots/list and notifications/roots/list_changed support
2026-04-15 02:39:14 +09:00
server_sampling_test.rb
Support notifications/cancelled per MCP specification
2026-05-03 04:02:22 +09:00
server_session_ping_test.rb
Support server-to-client ping per MCP specification
2026-05-22 11:28:51 +09:00
server_test.rb
Support W3C Trace Context Propagation via _meta per SEP-414
2026-06-12 14:36:24 +09:00
string_utils_test.rb
Fix ReDoS vulnerability in StringUtils#underscore
2026-01-09 01:14:52 +09:00
tool_test.rb
Speed Up Tool::Schema Validation by 5x to 100x
2026-06-01 21:47:30 +09:00
trace_context_test.rb
Support W3C Trace Context Propagation via _meta per SEP-414
2026-06-12 14:36:24 +09:00
transport_test.rb
Remove redundant require statements
2025-08-02 00:57:31 +09:00