pub trait TaskHandler: Send + Sync {
// Required methods
fn list_tasks(
&self,
ctx: &Context<'_>,
) -> impl Future<Output = Result<Vec<Task>, McpError>> + Send;
fn get_task(
&self,
id: &TaskId,
ctx: &Context<'_>,
) -> impl Future<Output = Result<Option<Task>, McpError>> + Send;
fn cancel_task(
&self,
id: &TaskId,
ctx: &Context<'_>,
) -> impl Future<Output = Result<bool, McpError>> + Send;
}Expand description
Handler for task-related operations.
Implement this trait to support long-running operations that can be tracked, monitored, and cancelled.
Required Methods§
Sourcefn list_tasks(
&self,
ctx: &Context<'_>,
) -> impl Future<Output = Result<Vec<Task>, McpError>> + Send
fn list_tasks( &self, ctx: &Context<'_>, ) -> impl Future<Output = Result<Vec<Task>, McpError>> + Send
List all tasks, optionally filtered by status.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.