Skip to content

Commit 28f4781

Browse files
authored
doc(streamable): add document for extracting http info (#373)
* docs(streamable): add document for extracting http info * docs: fix doc test
1 parent 1555c0f commit 28f4781

File tree

1 file changed

+13
-0
lines changed
  • crates/rmcp/src/transport/streamable_http_server

1 file changed

+13
-0
lines changed

crates/rmcp/src/transport/streamable_http_server/tower.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,19 @@ impl Default for StreamableHttpServerConfig {
4444
}
4545
}
4646

47+
/// # Streamable Http Server
48+
///
49+
/// ## Extract information from raw http request
50+
///
51+
/// The http service will consume the request body, however the rest part will be remain and injected into [`crate::model::Extensions`],
52+
/// which you can get from [`crate::service::RequestContext`].
53+
/// ```rust
54+
/// use rmcp::handler::server::tool::Extension;
55+
/// use http::request::Parts;
56+
/// async fn my_tool(Extension(parts): Extension<Parts>) {
57+
/// tracing::info!("http parts:{parts:?}")
58+
/// }
59+
/// ```
4760
pub struct StreamableHttpService<S, M = super::session::local::LocalSessionManager> {
4861
pub config: StreamableHttpServerConfig,
4962
session_manager: Arc<M>,

0 commit comments

Comments
 (0)