Expand description
Async task management for long-running MCP operations
This module provides task lifecycle management for operations that may take longer than a typical request/response cycle. Tasks can be enqueued, tracked, polled for status, and cancelled.
§Example
ⓘ
use tower_mcp::async_task::{TaskStore, Task};
use tower_mcp::protocol::TaskStatus;
// Create a task store
let store = TaskStore::new();
// Enqueue a task
let task = store.create_task("my-tool", serde_json::json!({"key": "value"}), None);
// Get task status
let info = store.get_task(&task.id);
// Mark task as complete
store.complete_task(&task.id, Ok(result));Structs§
- Cancellation
Token - A shareable cancellation token for task management
- Task
- Internal task representation with full state
- Task
Store - Thread-safe task storage