ruby-sdk/lib
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Yuki Minamiya c588582acc Add range validation for MCP::Annotations#priority per MCP specification
## Motivation and Context

The MCP specification constrains `Annotations.priority` to the 0–1 range
(`@minimum 0`, `@maximum 1`), but the Ruby SDK accepts any value. The other
official SDKs already enforce this (TypeScript, Python, and PHP).

This follows the existing pattern in `MCP::Icon`, which validates its
constrained `theme` value in the constructor and raises `ArgumentError`.

## How Has This Been Tested?

Added tests in `test/mcp/annotations_test.rb`:

- valid `priority` at the lower (0) and upper (1) bounds is accepted
- out-of-range `priority` (above 1, below 0) raises `ArgumentError`

The full unit suite and RuboCop pass locally.

## Breaking Changes

Strictly speaking yes: a caller that currently passes an out-of-range
`priority` (e.g. `priority: 99`) will now get an `ArgumentError`. Such values
already violate the MCP specification, and `nil` / in-range values are
unaffected.
2026-06-16 00:33:10 +09:00
..
mcp Add range validation for MCP::Annotations#priority per MCP specification 2026-06-16 00:33:10 +09:00
json_rpc_handler.rb Preserve the Request ID in Invalid Request Error Responses 2026-06-13 02:16:25 +09:00
mcp.rb Support W3C Trace Context Propagation via _meta per SEP-414 2026-06-12 14:36:24 +09:00