Skip to content

Commit 8acfcc3

Browse files
committed
fix: resolve SEP-414 PR ci check failures
1 parent ddb8d16 commit 8acfcc3

2 files changed

Lines changed: 18 additions & 24 deletions

File tree

crates/rmcp/src/model/meta.rs

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,23 @@ pub trait RequestParamsMeta {
5151
self.meta().and_then(|m| m.get_traceparent())
5252
}
5353
/// Set the W3C `traceparent` value in meta (SEP-414)
54-
fn set_traceparent(&mut self, value: impl Into<String>) {
54+
fn set_traceparent(&mut self, value: &str) {
5555
self.meta_or_default().set_traceparent(value);
5656
}
5757
/// Get the W3C `tracestate` value from meta, if present (SEP-414)
5858
fn tracestate(&self) -> Option<&str> {
5959
self.meta().and_then(|m| m.get_tracestate())
6060
}
6161
/// Set the W3C `tracestate` value in meta (SEP-414)
62-
fn set_tracestate(&mut self, value: impl Into<String>) {
62+
fn set_tracestate(&mut self, value: &str) {
6363
self.meta_or_default().set_tracestate(value);
6464
}
6565
/// Get the W3C `baggage` value from meta, if present (SEP-414)
6666
fn baggage(&self) -> Option<&str> {
6767
self.meta().and_then(|m| m.get_baggage())
6868
}
6969
/// Set the W3C `baggage` value in meta (SEP-414)
70-
fn set_baggage(&mut self, value: impl Into<String>) {
70+
fn set_baggage(&mut self, value: &str) {
7171
self.meta_or_default().set_baggage(value);
7272
}
7373
/// Get a mutable reference to meta, inserting an empty one if absent.
@@ -220,27 +220,6 @@ variant_extension! {
220220
CustomNotification
221221
}
222222
}
223-
/// The `_meta` field carried by MCP requests and notifications.
224-
///
225-
/// `Meta` is a transparent JSON object. Beyond the reserved `progressToken`, SEP-414 reserves the
226-
/// unprefixed keys [`TRACEPARENT_FIELD`], [`TRACESTATE_FIELD`], and [`BAGGAGE_FIELD`] for W3C trace
227-
/// context propagation. The SDK forwards these values untouched; bridging them to an OpenTelemetry
228-
/// pipeline is left to the application.
229-
///
230-
/// ```
231-
/// use rmcp::model::Meta;
232-
///
233-
/// // Client: copy the active span's context into `_meta` before sending the request
234-
/// // (attach the result via `PeerRequestOptions { meta: Some(..), .. }`).
235-
/// let mut meta = Meta::new();
236-
/// meta.set_traceparent("00-0af7651916cd43dd8448eb211c80319c-00f067aa0ba902b7-01");
237-
///
238-
/// // Server: read it back from the incoming request's `_meta`.
239-
/// assert_eq!(
240-
/// meta.get_traceparent(),
241-
/// Some("00-0af7651916cd43dd8448eb211c80319c-00f067aa0ba902b7-01"),
242-
/// );
243-
/// ```
244223
#[derive(Debug, Serialize, Deserialize, Clone, Default, PartialEq)]
245224
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
246225
#[serde(transparent)]
@@ -319,6 +298,17 @@ impl Meta {
319298
}
320299

321300
/// Set the W3C `traceparent` value (SEP-414).
301+
///
302+
/// ```
303+
/// use rmcp::model::Meta;
304+
///
305+
/// let mut meta = Meta::new();
306+
/// meta.set_traceparent("00-0af7651916cd43dd8448eb211c80319c-00f067aa0ba902b7-01");
307+
/// assert_eq!(
308+
/// meta.get_traceparent(),
309+
/// Some("00-0af7651916cd43dd8448eb211c80319c-00f067aa0ba902b7-01"),
310+
/// );
311+
/// ```
322312
pub fn set_traceparent(&mut self, value: impl Into<String>) {
323313
self.set_str(TRACEPARENT_FIELD, value);
324314
}

typos.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# W3C `traceparent` example values (SEP-414) embed hex spans like `0ba9` that the
2+
# spell checker misreads as typos; ignore the canonical traceparent format.
3+
[default]
4+
extend-ignore-re = ["00-[0-9a-f]{32}-[0-9a-f]{16}-[0-9a-f]{2}"]

0 commit comments

Comments
 (0)