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

Method call_tool

core/src/mcp/manager.rs:282–308  ·  view source on GitHub ↗

Call an MCP tool by full name Full name format: `mcp__ __ `

(
        &self,
        full_name: &str,
        arguments: Option<serde_json::Value>,
    )

Source from the content-addressed store, hash-verified

280 ///
281 /// Full name format: `mcp__<server>__<tool>`
282 pub async fn call_tool(
283 &self,
284 full_name: &str,
285 arguments: Option<serde_json::Value>,
286 ) -> Result<CallToolResult> {
287 // Parse full name
288 let (server_name, tool_name) = Self::parse_tool_name(full_name)?;
289
290 // Get client
291 let client = {
292 let clients = self.clients.read().await;
293 clients
294 .get(&server_name)
295 .cloned()
296 .ok_or_else(|| anyhow!("MCP server not connected: {}", server_name))?
297 };
298
299 // Refresh the activity timestamp before the await so an idle
300 // sweep running concurrently sees this server as recently used.
301 self.last_used_at_ms
302 .write()
303 .await
304 .insert(server_name.clone(), now_epoch_ms());
305
306 // Call tool
307 client.call_tool(&tool_name, arguments).await
308 }
309
310 /// Resolve an OAuth config into a `(header-name, header-value)` pair.
311 ///

Callers

nothing calls this directly

Calls 5

writeMethod · 0.80
now_epoch_msFunction · 0.70
getMethod · 0.45
insertMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected