Skip to content

docs: annotate Roots, Sampling, and Logging as deprecated per SEP-2577#429

Merged
koic merged 1 commit into
modelcontextprotocol:mainfrom
atesgoral:issue-390-deprecation-annotations
Jun 27, 2026
Merged

docs: annotate Roots, Sampling, and Logging as deprecated per SEP-2577#429
koic merged 1 commit into
modelcontextprotocol:mainfrom
atesgoral:issue-390-deprecation-annotations

Conversation

@atesgoral

Copy link
Copy Markdown
Contributor

TL;DR

Add advisory YARD @deprecated annotations for the Roots, Sampling, and Logging APIs deprecated by SEP-2577, without the protocol-version-gated runtime behavior change.

Context

SEP-2577 deprecates Roots, Sampling, and Logging in the 2026-07-28 protocol version. This PR splits the advisory annotations out of #406 per @koic's feedback, so the documentation can land now while the behavioral switch waits until the 2026-07-28 release is closer.

Refs #390

Changes

  • Add YARD @deprecated notes to the server, server-context, and server-session APIs for roots (roots_list_changed_handler, list_roots), sampling (create_sampling_message), and logging (notify_log_message).
  • Update the changelog.

Deliberately not included (deferred to a follow-up once 2026-07-28 is closer to release):

  • Adding 2026-07-28 to SUPPORTED_STABLE_PROTOCOL_VERSIONS.
  • The protocol-version-gated Kernel.warn runtime warnings and the ProtocolDeprecations helper.

Testing

Docs-only change (YARD comments + changelog). No behavior change; relies on CI for lint/test validation.

Split the advisory YARD @deprecated annotations out of modelcontextprotocol#406 so the
documentation can land ahead of the 2026-07-28 protocol release.

Per maintainer feedback, this drops the protocol-version-gated runtime
Kernel.warn behavior and the new 2026-07-28 supported protocol version,
leaving only the @deprecated notes for the Roots, Sampling, and Logging
APIs deprecated by SEP-2577.

Refs modelcontextprotocol#390

Co-authored-by: 🦞 Qlaw <noreply@qlaw.quick.shopify.io>
@koic koic merged commit 5518e8d into modelcontextprotocol:main Jun 27, 2026
11 checks passed
koic added a commit that referenced this pull request Jul 15, 2026
## Motivation and Context

The MCP specification defines `sampling/createMessage` as a server-to-client request
that lets a server ask the client to generate an LLM completion, so the server can leverage
the client's model access without its own API keys.
The Ruby SDK already supports the server side (sending the request) and, on the client side,
the generic server-to-client request infrastructure introduced for elicitation
(the standalone GET SSE listening stream and `on_server_request` dispatch).
This adds the client-side `sampling/createMessage` handler on top of that infrastructure.

## Changes

- Add `MCP::Client#on_sampling`, a thin wrapper that registers a `sampling/createMessage` handler
  via `transport.on_server_request`, mirroring `on_elicitation`. The handler receives the request params
  and returns a `CreateMessageResult`-shaped Hash sent back as the JSON-RPC result.
- Document client-side sampling in the README, including the `sampling` (and `sampling.tools`)
  capability declaration and the human-in-the-loop guidance from the specification.

## How Has This Been Tested?

- Unit tests for `on_sampling` covering handler registration on the transport
  and the error raised when the transport does not support server-to-client requests.
- An HTTP transport test that dispatches a `sampling/createMessage` server request delivered on
  the SSE stream and returns a `CreateMessageResult`.

## Deprecation Note

SEP-2577 deprecates sampling (along with roots and logging) starting with protocol version `2026-07-28`.
The deprecation warnings are added in #406.
Sampling remains fully supported under the current `2025-11-25` protocol version and stays available
throughout the spec's deprecation window, so the client side is implemented here for parity with
the server side and with the Python and TypeScript SDKs.

`MCP::Client#on_sampling` carries the same `@deprecated` annotation as the server-side senders
annotated in #429, tailored to the receiving side: the handler exists to interoperate with servers
that still send sampling requests during the deprecation window. The README section carries
the same note.

Ref: https://modelcontextprotocol.io/specification/2025-11-25/client/sampling
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