feat: allow failable service creation in streamable HTTP tower service (#244)

* feat: allow failable service creation in streamable HTTP tower service

In our setup we need to lookup some info that may fail before we serve
the request.

* Fix examples build
This commit is contained in:
John Howard 2025-06-15 10:13:35 -07:00 • committed by GitHub
commit 73188eff6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 8 deletions

View file

@ -12,7 +12,7 @@ use rmcp::transport::streamable_http_server::{
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let service = TowerToHyperService::new(StreamableHttpService::new(
Counter::new,
|| Ok(Counter::new()),
LocalSessionManager::default().into(),
Default::default(),
));

View file

@ -22,7 +22,7 @@ async fn main() -> anyhow::Result<()> {
.init();
let service = StreamableHttpService::new(
Counter::new,
|| Ok(Counter::new()),
LocalSessionManager::default().into(),
Default::default(),
);