fix(examples): Prevent transport from closing due to premature client drop (#324)

This commit is contained in:
kah 2025-07-21 10:40:47 +09:00 • committed by GitHub
commit 8967daf87f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -74,7 +74,7 @@ async fn main() -> Result<()> {
if config.mcp.is_some() {
let mcp_clients = config.create_mcp_clients().await?;
for (name, client) in mcp_clients {
for (name, client) in mcp_clients.iter() {
println!("load MCP tool: {}", name);
let server = client.peer().clone();
let tools = get_mcp_tools(server).await?;
@ -84,6 +84,7 @@ async fn main() -> Result<()> {
tool_set.add_tool(tool);
}
}
tool_set.set_clients(mcp_clients);
}
// create chat session