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

Method tool

sdk/node/src/lib.rs:3653–3661  ·  view source on GitHub ↗
(&self, name: String, args: serde_json::Value)

Source from the content-addressed store, hash-verified

3651 /// Execute a tool by name, bypassing the LLM.
3652 #[napi]
3653 pub async fn tool(&self, name: String, args: serde_json::Value) -> napi::Result<ToolResult> {
3654 let session = self.inner.clone();
3655 let result = get_runtime()
3656 .spawn(async move { session.tool(&name, args).await })
3657 .await
3658 .map_err(|e| napi::Error::from_reason(format!("Task join error: {e}")))?
3659 .map_err(|e| napi::Error::from_reason(format!("Tool execution failed: {e}")))?;
3660 Ok(tool_result_from_core(result))
3661 }
3662
3663 /// Delegate a bounded task to a child agent through the built-in `task` tool.
3664 #[napi(ts_args_type = "options: DelegateTaskOptions")]

Callers 10

taskMethod · 0.45
tasksMethod · 0.45
programMethod · 0.45
web_searchMethod · 0.45
gitMethod · 0.45
git_commandMethod · 0.45
fetchViaSearchMethod · 0.45
fetchViaMcpMethod · 0.45
mainFunction · 0.45

Calls 4

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

Tested by

no test coverage detected