From 219c199541529009807c2bfaec0e45b57e42772b Mon Sep 17 00:00:00 2001 From: 4t145 Date: Thu, 14 Aug 2025 14:26:17 +0800 Subject: [PATCH 1/2] docs(streamable): add document for extracting http info --- .../src/transport/streamable_http_server/tower.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/rmcp/src/transport/streamable_http_server/tower.rs b/crates/rmcp/src/transport/streamable_http_server/tower.rs index 90473b32..aeef8202 100644 --- a/crates/rmcp/src/transport/streamable_http_server/tower.rs +++ b/crates/rmcp/src/transport/streamable_http_server/tower.rs @@ -44,6 +44,19 @@ impl Default for StreamableHttpServerConfig { } } +/// # Streamable Http Server +/// +/// ## Extract information from raw http request +/// +/// The http service will consume the request body, however the rest part will be remain and injected into [`crate::model::Extensions`], +/// which you can get from [`crate::service::RequestContext`]. +/// ```rust +/// use rmcp::tool::Extension; +/// use http::request::Parts; +/// async fn my_tool(Extension(parts): Extension) { +/// tracing::info("http parts:{parts:?}") +/// } +/// ``` pub struct StreamableHttpService { pub config: StreamableHttpServerConfig, session_manager: Arc, From 406e3a0073de952f412d775ca3248c3ab91d51dd Mon Sep 17 00:00:00 2001 From: 4t145 Date: Thu, 14 Aug 2025 14:49:06 +0800 Subject: [PATCH 2/2] docs: fix doc test --- crates/rmcp/src/transport/streamable_http_server/tower.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/rmcp/src/transport/streamable_http_server/tower.rs b/crates/rmcp/src/transport/streamable_http_server/tower.rs index aeef8202..475dbff3 100644 --- a/crates/rmcp/src/transport/streamable_http_server/tower.rs +++ b/crates/rmcp/src/transport/streamable_http_server/tower.rs @@ -51,10 +51,10 @@ impl Default for StreamableHttpServerConfig { /// The http service will consume the request body, however the rest part will be remain and injected into [`crate::model::Extensions`], /// which you can get from [`crate::service::RequestContext`]. /// ```rust -/// use rmcp::tool::Extension; +/// use rmcp::handler::server::tool::Extension; /// use http::request::Parts; /// async fn my_tool(Extension(parts): Extension) { -/// tracing::info("http parts:{parts:?}") +/// tracing::info!("http parts:{parts:?}") /// } /// ``` pub struct StreamableHttpService {