doc(streamable): add document for extracting http info (#373)

* docs(streamable): add document for extracting http info

* docs: fix doc test
This commit is contained in:
4t145 2025-08-15 11:12:48 +08:00 • committed by GitHub
commit 28f4781332
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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<Parts>) {
/// tracing::info!("http parts:{parts:?}")
/// }
/// ```
pub struct StreamableHttpService<S, M = super::session::local::LocalSessionManager> {
pub config: StreamableHttpServerConfig,
session_manager: Arc<M>,