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:
parent
5ccdfc07be
commit
d695046ffa
2 changed files with 6 additions and 3 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -259,7 +259,7 @@ jobs:
|
||||||
if [ -f "$dir/Cargo.toml" ]; then
|
if [ -f "$dir/Cargo.toml" ]; then
|
||||||
if [[ "$dir" != *"wasi"* ]]; then
|
if [[ "$dir" != *"wasi"* ]]; then
|
||||||
echo "Testing $dir"
|
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
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
|
||||||
|
|
@ -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> {
|
async fn long_task(&self) -> Result<CallToolResult, McpError> {
|
||||||
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
|
tokio::time::sleep(std::time::Duration::from_secs(10)).await;
|
||||||
Ok(CallToolResult::success(vec![Content::text(
|
Ok(CallToolResult::success(vec![Content::text(
|
||||||
|
|
@ -360,7 +363,7 @@ mod tests {
|
||||||
"source".into(),
|
"source".into(),
|
||||||
serde_json::Value::String("integration-test".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
|
let response = client_service
|
||||||
.send_request(ClientRequest::CallToolRequest(Request::new(params.clone())))
|
.send_request(ClientRequest::CallToolRequest(Request::new(params.clone())))
|
||||||
.await?;
|
.await?;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue