pub struct Task {
pub id: String,
pub created_at: DateTime<Utc>,
pub last_updated_at: DateTime<Utc>,
pub ttl: usize,
pub status: TaskStatus,
pub status_msg: Option<String>,
pub poll_interval: Option<usize>,
}Expand description
Represents a task. Tasks are durable state machines that carry information about the underlying execution state of the request they wrap, and are intended for requestor polling and deferred result retrieval.
Each task is uniquely identifiable by a receiver-generated task ID.
See the schema for details
Fields§
§id: StringThe task identifier.
created_at: DateTime<Utc>ISO 8601 timestamp when the task was created.
last_updated_at: DateTime<Utc>ISO 8601 timestamp when the task was last updated.
ttl: usizeTime To Live: Actual retention duration from creation in milliseconds, null for unlimited.
status: TaskStatusCurrent task state.
status_msg: Option<String>Optional human-readable message describing the current task state. This can provide context for any status, including
- Reasons for
cancelledstatus - Summaries for
completedstatus - Diagnostic information for
failedstatus (e.g., error details, what went wrong)
poll_interval: Option<usize>Suggested polling interval in milliseconds.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Task
impl<'de> Deserialize<'de> for Task
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<TaskMetadata> for Task
impl From<TaskMetadata> for Task
Source§fn from(meta: TaskMetadata) -> Self
fn from(meta: TaskMetadata) -> Self
Converts to this type from the input type.
Source§impl IntoResponse for Task
impl IntoResponse for Task
Source§fn into_response(self, req_id: RequestId) -> Response
fn into_response(self, req_id: RequestId) -> Response
Converts a type into MCP server response
Auto Trait Implementations§
impl Freeze for Task
impl RefUnwindSafe for Task
impl Send for Task
impl Sync for Task
impl Unpin for Task
impl UnwindSafe for Task
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)