Repository navigation
Implement SEP-2577: Deprecate Roots, Sampling, and Logging #881
Description
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 inmodel/capabilities.rs(SamplingCapability,enable_sampling*builders) andSamplingTaskCapability. - Roots:
method!(peer_req list_roots ListRootsRequest() => ListRootsResult)(service/server.rs:444);RootsCapabilities+enable_roots*builders inmodel/capabilities.rs;ListRootsResult/roots request types inmodel.rs. - Logging: client
method!(peer_req set_level SetLevelRequest(..))(service/client.rs:357); servermethod!(peer_not notify_logging_message LoggingMessageNotification(..))(service/server.rs:454);enable_loggingbuilder;LoggingMessageNotification/SetLevelRequesttypes.
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 themethod!-generatedlist_roots/set_level/notify_logging_messageandcreate_message. - Apply matching deprecation to the capability builders (
enable_roots*,enable_sampling*,enable_logging) and capability structs inmodel/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.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsIn Progress
Activity
rohitg00 commentedon Jun 3, 2026
Can I pick this up? @alexhancock
alexhancock commentedon Jun 3, 2026
@rohitg00 Yeah go for it. Would love a clean PR for it
rohitg00 commentedon Jun 3, 2026
Thanks @alexhancock, working on it.
rohitg00 commentedon Jun 3, 2026
Using this deprecation attrs:
rohitg00 commentedon Jun 3, 2026
hey @alexhancock PR is out now #884
DaleSeo commentedon Jun 23, 2026
@alexhancock I noticed that the
#[deprecated]annotations were only added to the service methods likecreate_message,list_roots,set_level, andnotify_logging_message, as well as to the capability structs and builders. However, the model types marked as@deprecatedin the 2026-07-28 schema under SEP-2577 were not annotated in the SDK.We still need to add
#[deprecated]to the following:CreateMessageRequest,CreateMessageRequestParams,CreateMessageResult,SamplingMessage,SamplingMessageContent,ToolUseContent,ToolResultContent,ModelPreferences,ModelHint,ToolChoiceListRootsRequest,ListRootsResult,RootLoggingMessageNotification,LoggingMessageNotificationParams,LoggingLevel,SetLevelRequest,SetLevelRequestParamsI'll open a follow-up PR to add the
#[deprecated]annotations to these.