Skip to main content

rmcp_traces/
lib.rs

1// Render per-item feature-requirement badges when rustdoc runs on nightly with
2// `--cfg docsrs` (docs.rs posture; locally via `cargo xtask doc --docsrs-cfg`).
3// Inert under the stable CI doc gate: stable rustdoc never sets `docsrs`.
4#![cfg_attr(docsrs, feature(doc_auto_cfg))]
5//! Bounded, log-safe helpers for RMCP trace metadata.
6//!
7//! `rmcp-traces` complements RMCP's own `_meta` serialization. It does not own
8//! MCP wire encoding and it does not attach result `_meta` in v1.
9//!
10//! ## RMCP Version
11//!
12//! This crate targets `rmcp 2.2.0`.
13//!
14//! ## Deferred V1 Surfaces
15//!
16//! Result `_meta` helpers are deferred because protocol-level metadata must be
17//! budgeted together with Soma's normal, paged, cached-page, structured-error,
18//! auth-denial, and protocol-denial paths.
19//!
20//! The optional `http` feature extracts inbound W3C `traceparent`,
21//! `tracestate`, and, when explicitly enabled, `baggage` headers into RMCP
22//! request metadata. Baggage is default-off. HTTP extraction never adds
23//! outbound propagation or result `_meta`.
24//! `tracestate` validation intentionally keeps Soma's stricter local policy
25//! for now: empty or whitespace-only list members are rejected.
26//!
27//! Outbound HTTP propagation is deferred because baggage and sampled flags need
28//! an application trust-boundary policy before public header forwarding is safe.
29
30#![forbid(unsafe_code)]
31
32mod trace_context;
33
34#[cfg(feature = "http")]
35pub mod http;
36
37pub use trace_context::{
38    TraceLimits, TraceParseError, TraceSummary, TraceTrust, BAGGAGE_KEY, TRACEPARENT_KEY,
39    TRACESTATE_KEY,
40};