TaskHandler

Trait TaskHandler 

Source
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§

Source

fn list_tasks( &self, ctx: &Context<'_>, ) -> impl Future<Output = Result<Vec<Task>, McpError>> + Send

List all tasks, optionally filtered by status.

Source

fn get_task( &self, id: &TaskId, ctx: &Context<'_>, ) -> impl Future<Output = Result<Option<Task>, McpError>> + Send

Get the current state of a task.

Source

fn cancel_task( &self, id: &TaskId, ctx: &Context<'_>, ) -> impl Future<Output = Result<bool, McpError>> + Send

Cancel a running task.

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.

Implementors§