feat: deprecate roots, sampling, and logging (SEP-2577)#884
Conversation
SEP-2577 deprecates the Roots, Sampling, and Logging features. The deprecation is advisory: the features stay fully functional and there is no wire-level change. Mark the corresponding Rust APIs as deprecated so downstream users get compiler warnings and migration guidance. - Forward attributes through the service `method!` macros and deprecate `Peer::create_message`, `Peer::list_roots`, `Peer::set_level`, and `Peer::notify_logging_message`. - Forward per-field attributes through the capability `builder!` macro and deprecate the generated `enable_roots`, `enable_sampling`, and `enable_logging` builders, plus the hand-written `enable_roots_list_changed`, `enable_sampling_tools`, and `enable_sampling_context`. - Document the deprecation on the capability types and fields, and in the README feature sections. - Allow `deprecated` at the crate's own call sites so the build stays warning-clean, and refresh the message schema snapshots.
alexhancock
left a comment
There was a problem hiding this comment.
This is really good and thanks for the quick turnaround!
The macros are getting kind of crazy... do you think it's worth modifying all of them for this or would it be better to find another way?
|
Good catch @alexhancock I think that's the best way, I also went back and forth on this, so let me lay out why I kept the macro route. The change is fully additive: every arm gets an optional leading The alternative is pulling Forwarding the attribute fixes that once. Any arm can then carry
|
Fixes #881
Motivation and Context
SEP-2577 deprecates three core protocol features: Roots, Sampling, and Logging. The deprecation is advisory. The features stay fully functional and there is no wire-level change; the SDK should signal the deprecation so downstream users get compiler warnings and migration guidance.
This marks the corresponding Rust APIs with
#[deprecated]:Peer::create_message(sampling),Peer::list_roots(roots),Peer::set_levelandPeer::notify_logging_message(logging). These are generated by themethod!macros, which previously had no way to attach an attribute to a single entry, so the macros now forward an optional attribute list to the generated function.enable_roots,enable_sampling, andenable_logging(and their_withvariants), plus the hand-writtenenable_roots_list_changed,enable_sampling_tools, andenable_sampling_context. Thebuilder!macro now forwards per-field attributes to the generatedenable_*methods.The capability data structs (
RootsCapabilities,SamplingCapability,SamplingTaskCapability) and the wire request/result types are documented as deprecated but not annotated with#[deprecated]. They carry no behavior, the spec makes no wire change, and theschemars::JsonSchemaderive re-emits the lint past an item-level#[allow(deprecated)], which would force a broad module-level allow. Keeping the annotations on the API surface that users actually call gives the same advisory signal without the noise.#[allow(deprecated)]is added at the crate's own call sites (handlers, the logging/sampling test suites, the sampling example, and the conformance server) so the build stays warning-clean. Thetest_message_schemasnapshots are refreshed to pick up the new descriptions.How Has This Been Tested?
cargo clippy -p rmcp --all-features --all-targets -- -D warnings cargo test -p rmcp --all-features cargo +nightly fmt --all -- --checkAll pass. The sampling example and conformance server also build without deprecation warnings.
Breaking Changes
None. Deprecation attributes are advisory and do not change behavior or the wire format.
Types of changes
Checklist
Additional context
The
sincevalue is set to1.8.0, matching the most recent#[deprecated]added in #855.