MCPcopy Index your code
hub / github.com/AI45Lab/Code / task

Method task

sdk/node/src/lib.rs:3665–3675  ·  view source on GitHub ↗
(&self, options: DelegateTaskOptions)

Source from the content-addressed store, hash-verified

3663 /// Delegate a bounded task to a child agent through the built-in `task` tool.
3664 #[napi(ts_args_type = "options: DelegateTaskOptions")]
3665 pub async fn task(&self, options: DelegateTaskOptions) -> napi::Result<ToolResult> {
3666 let args = delegate_task_options_to_args(options);
3667
3668 let session = self.inner.clone();
3669 let result = get_runtime()
3670 .spawn(async move { session.tool("task", args).await })
3671 .await
3672 .map_err(|e| napi::Error::from_reason(format!("Task join error: {e}")))?
3673 .map_err(|e| napi::Error::from_reason(format!("Task delegation failed: {e}")))?;
3674 Ok(tool_result_from_core(result))
3675 }
3676
3677 /// Delegate a bounded task to a child agent through the built-in `task` tool.
3678 #[napi(ts_args_type = "options: DelegateTaskOptions")]

Calls 6

tool_result_from_coreFunction · 0.85
get_runtimeFunction · 0.70
cloneMethod · 0.45
spawnMethod · 0.45
toolMethod · 0.45

Tested by

no test coverage detected