Skip to content

Implement SEP-2577: Deprecate Roots, Sampling, and Logging #881

Closed

Description

@alexhancock

SEP-2577: Deprecate Roots, Sampling, and Logging — rust-sdk implementation

Spec PR: modelcontextprotocol/modelcontextprotocol#2577
Track: Specification · Stage: final · Priority: P1
Needs code changes: Yes (Small) — advisory only, no wire change

Summary

Deprecates three core protocol features — Roots, Sampling, and Logging. Features remain
fully functional in all spec versions released within one year of the deprecating version. There
are no wire-level protocol changes; the deprecation is advisory, signaling the ecosystem to plan
for eventual removal.

Why this needs code changes in rust-sdk

No wire change, but to align with the spec the SDK should mark the corresponding Rust APIs as
deprecated so downstream users get compiler warnings and migration guidance. Concrete targets:

  • Sampling: ServerPeer::create_message(..) (service/server.rs:415); sampling capability bits in model/capabilities.rs (SamplingCapability, enable_sampling* builders) and SamplingTaskCapability.
  • Roots: method!(peer_req list_roots ListRootsRequest() => ListRootsResult) (service/server.rs:444); RootsCapabilities + enable_roots* builders in model/capabilities.rs; ListRootsResult/roots request types in model.rs.
  • Logging: client method!(peer_req set_level SetLevelRequest(..)) (service/client.rs:357); server method!(peer_not notify_logging_message LoggingMessageNotification(..)) (service/server.rs:454); enable_logging builder; LoggingMessageNotification / SetLevelRequest types.

Caveat: several of these are generated by the internal method! macro and the capability builders
are macro-generated too, so #[deprecated] may need to be applied at the macro-invocation site (or
the macro taught to forward a #[deprecated] attribute) rather than on a hand-written fn.

Proposed work

  • Add #[deprecated(since = "0.x.0", note = "Deprecated by SEP-2577; see <url>")] to the sampling/roots/logging public surface — including the method!-generated list_roots / set_level / notify_logging_message and create_message.
  • Apply matching deprecation to the capability builders (enable_roots*, enable_sampling*, enable_logging) and capability structs in model/capabilities.rs.
  • Add doc comments pointing to the SEP and recommended alternatives.
  • Keep all functionality intact (must remain working for ≥1 year of spec versions per SEP-2596).
  • Add #[allow(deprecated)] at the crate's own internal call sites (the SDK's own handlers/tests use these) so the build stays warning-clean.
  • Update README/feature docs to note deprecation status.

Affected areas

crates/rmcp/src/service/server.rs (create_message, list_roots, notify_logging_message),
crates/rmcp/src/service/client.rs (set_level), model/capabilities.rs (capability structs + builders),
model.rs (roots/logging request/result types), and possibly the method! macro definition.

Notes / risks

  • Purely additive deprecation annotations; no behavioral/wire change. Coordinate wording with SEP-2596 (feature lifecycle policy) once that lands.

Activity

  1. added
    T-enhancementNew features and enhancements
    T-modelModel/data structure changes
    T-serviceService layer changes
    P2Medium: important but non-blocking improvement
    on Jun 2, 2026
  2. rohitg00 commented on Jun 3, 2026

    @rohitg00
    Contributor

    Can I pick this up? @alexhancock

  3. alexhancock commented on Jun 3, 2026

    @alexhancock
    ContributorAuthor

    @rohitg00 Yeah go for it. Would love a clean PR for it

  4. rohitg00 commented on Jun 3, 2026

    @rohitg00
    Contributor

    Thanks @alexhancock, working on it.

  5. rohitg00 commented on Jun 3, 2026

    @rohitg00
    Contributor

    Using this deprecation attrs:

            #[deprecated(
                since = "1.8.0",
                note = "Roots is deprecated by SEP-2577 and will be removed in a future release. See https://github.com/modelcontextprotocol/modelcontextprotocol/pull/2577"
    
  6. rohitg00 commented on Jun 3, 2026

    @rohitg00
    Contributor

    hey @alexhancock PR is out now #884

  7. DaleSeo commented on Jun 23, 2026

    @DaleSeo
    Member

    @alexhancock I noticed that the #[deprecated] annotations were only added to the service methods like create_message, list_roots, set_level, and notify_logging_message, as well as to the capability structs and builders. However, the model types marked as @deprecated in the 2026-07-28 schema under SEP-2577 were not annotated in the SDK.

    We still need to add #[deprecated] to the following:

    • Sampling: CreateMessageRequest, CreateMessageRequestParams, CreateMessageResult, SamplingMessage, SamplingMessageContent, ToolUseContent, ToolResultContent, ModelPreferences, ModelHint, ToolChoice
    • Roots: ListRootsRequest, ListRootsResult, Root
    • Logging: LoggingMessageNotification, LoggingMessageNotificationParams, LoggingLevel, SetLevelRequest, SetLevelRequestParams

    I'll open a follow-up PR to add the #[deprecated] annotations to these.

  8. self-assigned this
    on Jun 23, 2026
  9. added this to the 2026-07-28 spec milestone on Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

2026-07-28P2Medium: important but non-blocking improvementT-enhancementNew features and enhancementsT-modelModel/data structure changesT-serviceService layer changes

Type

No type

Projects

Relationships

None yet

Development

No branches or pull requests

Issue actions