ruby-sdk/lib/mcp
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Koichi ITO 14bf3a7091 Stamp the required resultType on modern results per SEP-2322
## Motivation and Context

SEP-2322 (merged for the 2026-07-28 spec release) makes `resultType` a REQUIRED member of every result
a 2026-07-28 server returns: "Servers implementing this protocol version MUST include this field",
with absence tolerated only when the result comes FROM an earlier protocol version.
The client-side vocabulary landed earlier (`MCP::ResultType`, treating an absent value as `"complete"`),
but every ordinary modern result the server returns is unstamped, which violates the MUST for `tools/list`,
`tools/call`, `ping`, and every other standard result on the modern wire.
The conformance suite's 2026-07-28 requirements fail each of those scenarios on wire-schema validation
(`CallToolResult: must have required property 'resultType'`).

The dispatch path now stamps `resultType: "complete"` centrally: any Hash result of a request carrying
the SEP-2575 `_meta` envelope that does not already carry a `resultType` gets the standard value merged in.
Results that already carry a discriminator keep it, notifications and cancellation-suppressed responses
are untouched, and legacy results stay unstamped because pre-2026 clients do not know the field.
`server/discover`, which is exempt from the `_meta` envelope (pre-version discovery),
stamps its `DiscoverResult` at its construction site instead.

## How Has This Been Tested?

`bundle exec rake test` passes with zero failures. New tests in `test/mcp/server_test.rb`: `tools/list`,
`ping`, and `tools/call` results carry `resultType: "complete"` on modern requests and no `resultType`
on legacy requests; `server/discover` carries the stamp. The conformance scenarios previously failing
on the missing property (`tools-call-simple-text`, `prompts-get-simple`, `completion-complete`, and
the other tools/prompts scenarios) pass at `--spec-version 2026-07-28` against the conformance fixture server.

## Breaking Changes

None. The stamp applies only to results of requests carrying the SEP-2575 modern `_meta` envelope;
results on stable protocol versions through 2025-11-25 are byte-for-byte unchanged.
2026-08-08 15:12:18 +09:00
..
client Finalize server/discover and Add Client Modern Lifecycle Support per SEP-2575 2026-08-08 03:45:00 +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 Let Handlers Return Multi Round-Trip input_required Results per SEP-2322 2026-08-08 15:07:16 +09:00
tool fix: preserve explicit tool response content 2026-07-23 03:11:48 +08:00
annotations.rb Add audience role validation for MCP::Annotations per MCP specification 2026-06-22 01:13:17 +09:00
apps.rb Add Server-Side MCP Apps Helpers per SEP-1865 2026-07-07 01:16:02 +09:00
cancellation.rb Support notifications/cancelled per MCP specification 2026-05-03 04:02:22 +09:00
cancelled_error.rb Support notifications/cancelled per MCP specification 2026-05-03 04:02:22 +09:00
client.rb Finalize server/discover and Add Client Modern Lifecycle Support per SEP-2575 2026-08-08 03:45:00 +09:00
configuration.rb feat: deprecate roots sampling and logging 2026-08-02 13:13:10 -04:00
content.rb Add _meta field to resource, content, and result classes 2026-04-11 15:08:55 +09:00
error_codes.rb Add Stateless Lifecycle Foundations per SEP-2575 2026-07-26 20:03:57 +09:00
icon.rb Fix RuboCop offenses detected with rubocop-shopify 3.0.0 2026-07-15 01:46:51 +09:00
instrumentation.rb Fix RuboCop offenses detected with rubocop-shopify 3.0.0 2026-07-15 01:46:51 +09:00
logging_message_notification.rb logging_message_notification: Remove unused require 2026-02-05 16:05:08 -05:00
methods.rb Add server/discover and stateless lifecycle error codes per SEP-2575 2026-07-04 20:24:37 +09:00
progress.rb Support POST response SSE streams for server-to-client messages 2026-04-04 19:20:31 +09:00
prompt.rb Use autoload to defer loading of unused subsystems 2026-03-12 14:08:27 +09:00
protocol_deprecations.rb feat: deprecate roots sampling and logging 2026-08-02 13:13:10 -04:00
request_envelope.rb Finalize server/discover and Add Client Modern Lifecycle Support per SEP-2575 2026-08-08 03:45:00 +09:00
resource.rb Support class-based Resource and ResourceTemplate definitions 2026-07-10 22:39:42 +09:00
resource_template.rb Fix RuboCop offenses detected with rubocop-shopify 3.0.0 2026-07-15 01:46:51 +09:00
result_type.rb Recognize multi round-trip input_required results per SEP-2322 2026-06-30 11:34:17 +09:00
server.rb Stamp the required resultType on modern results per SEP-2322 2026-08-08 15:12:18 +09:00
server_context.rb Let Handlers Return Multi Round-Trip input_required Results per SEP-2322 2026-08-08 15:07:16 +09:00
server_session.rb feat: deprecate roots sampling and logging 2026-08-02 13:13:10 -04:00
string_utils.rb Fix ReDoS vulnerability in StringUtils#underscore 2026-01-09 01:14:52 +09:00
tool.rb Use autoload to defer loading of unused subsystems 2026-03-12 14:08:27 +09:00
trace_context.rb Support W3C Trace Context Propagation via _meta per SEP-414 2026-06-12 14:36:24 +09:00
transport.rb Auto-set server.transport in Transport#initialize 2026-04-09 12:08:55 +09:00
version.rb Release 1.1.0 2026-08-01 11:29:49 +09:00