Call an MCP tool by full name Full name format: `mcp__ __ `
(
&self,
full_name: &str,
arguments: Option<serde_json::Value>,
)
| 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 | /// |
nothing calls this directly
no test coverage detected