executeTool

suspend fun executeTool(name: String, params: Map<String, Any>, clientLabel: String? = null): ToolResult

Execute the named tool with params on Dispatchers.IO, bounded by toolTimeoutMs. Returns a tool_disabled error if the tool is gated off, an Unknown tool error if it isn't registered, a tool_timeout error if it overran, and converts any exception thrown by McpTool.execute into a failed ToolResult. Coroutine cancellation of the caller is rethrown rather than swallowed, so a cancelled request stops its tool.

When a confirmer is set and requiresConfirmation matches, the host is asked first; the tool runs only on approval, otherwise the result is a tool_call_declined error.

Parameters

clientLabel

The HTTP client making the call (passed to the confirmer); null in-process.