MCPcopy Create free account
hub / github.com/AI45Lab/Code / execute

Method execute

core/src/mcp/tools.rs:61–79  ·  view source on GitHub ↗
(&self, args: &serde_json::Value, _ctx: &ToolContext)

Source from the content-addressed store, hash-verified

59 }
60
61 async fn execute(&self, args: &serde_json::Value, _ctx: &ToolContext) -> Result<ToolOutput> {
62 // Call the MCP tool through the manager
63 let result = self
64 .manager
65 .call_tool(&self.full_name, Some(args.clone()))
66 .await;
67
68 match result {
69 Ok(tool_result) => {
70 let output = tool_result_to_string(&tool_result);
71 if tool_result.is_error {
72 Ok(ToolOutput::error(output))
73 } else {
74 Ok(ToolOutput::success(output))
75 }
76 }
77 Err(e) => Ok(ToolOutput::error(format!("MCP tool error: {}", e))),
78 }
79 }
80}
81
82/// Create tool wrappers for all tools from an MCP server

Callers

nothing calls this directly

Calls 3

tool_result_to_stringFunction · 0.85
call_toolMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected