From 28f4781332276f680c81aa447274986bcc84068f Mon Sep 17 00:00:00 2001 From: 4t145 Date: Fri, 15 Aug 2025 11:12:48 +0800 Subject: [PATCH] doc(streamable): add document for extracting http info (#373) * docs(streamable): add document for extracting http info * docs: fix doc test --- .../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 90473b3..475dbff 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::handler::server::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,