fix: enable task support on counter long_task example (#838)

* fix: enable task support on counter long_task example

* ci: include example targets when testing example crates
This commit is contained in:
Dale Seo 2026-05-13 09:22:58 -04:00 committed by GitHub
parent 5ccdfc07be
commit d695046ffa
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 3 deletions

View file

@ -259,7 +259,7 @@ jobs:
if [ -f "$dir/Cargo.toml" ]; then
if [[ "$dir" != *"wasi"* ]]; then
echo "Testing $dir"
cargo test --manifest-path "$dir/Cargo.toml" --all-features
cargo test --manifest-path "$dir/Cargo.toml" --all-features --all-targets
fi
fi
done

View file

@ -103,7 +103,10 @@ impl Counter {
)]))
}
#[tool(description = "Long running task example")]
#[tool(
description = "Long running task example",
execution(task_support = "optional")
)]
async fn long_task(&self) -> Result<CallToolResult, McpError> {
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
Ok(CallToolResult::success(vec![Content::text(
@ -360,7 +363,7 @@ mod tests {
"source".into(),
serde_json::Value::String("integration-test".into()),
);
let params = CallToolRequestParams::new("long_task").with_task(Some(task_meta));
let params = CallToolRequestParams::new("long_task").with_task(task_meta);
let response = client_service
.send_request(ClientRequest::CallToolRequest(Request::new(params.clone())))
.await?;