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:
parent
1555c0fa33
commit
28f4781332
1 changed files with 13 additions and 0 deletions
|
|
@ -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>,
|
||||
|
|
|
|||
Loading…
Reference in a new issue