pub struct CreateTaskResult {
pub task: Task,
pub _meta: Option<HashMap<String, Value>>,
}Expand description
Result type for task creation (immediate response to task-augmented requests)
When a request is augmented with task metadata, the receiver responds immediately
with this result containing the task object. The actual operation result is available
later via tasks/result.
§Two-Phase Response Pattern
Phase 1 (Immediate):
Client → tools/call (task: {...})
Server → CreateTaskResult (task with status: working)
Phase 2 (Deferred):
Client → tasks/result (taskId)
Server → CallToolResult (actual tool response)§Examples
use turbomcp_protocol::types::tasks::{CreateTaskResult, Task, TaskStatus};
let response = CreateTaskResult {
task: Task {
task_id: "task-abc123".to_string(),
status: TaskStatus::Working,
status_message: None,
created_at: "2025-11-25T10:30:00Z".to_string(),
ttl: Some(60_000),
poll_interval: Some(5_000),
},
_meta: None,
};Fields§
§task: TaskThe created task with initial state (typically Working)
_meta: Option<HashMap<String, Value>>Optional metadata
Host applications can use io.modelcontextprotocol/model-immediate-response
to provide immediate feedback to the model before task completion.
Trait Implementations§
Source§impl Clone for CreateTaskResult
impl Clone for CreateTaskResult
Source§fn clone(&self) -> CreateTaskResult
fn clone(&self) -> CreateTaskResult
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for CreateTaskResult
impl Debug for CreateTaskResult
Source§impl<'de> Deserialize<'de> for CreateTaskResult
impl<'de> Deserialize<'de> for CreateTaskResult
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
Auto Trait Implementations§
impl Freeze for CreateTaskResult
impl RefUnwindSafe for CreateTaskResult
impl Send for CreateTaskResult
impl Sync for CreateTaskResult
impl Unpin for CreateTaskResult
impl UnwindSafe for CreateTaskResult
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more