Executor for MCP-backed tool specs.
Called by ExAthena.Tool.Spec.execute/3 for specs with kind: :mcp.
Looks up the server pid in the registry, calls tools/call via the
Client, and maps the result to the loop's {:ok, content} | {:error, reason}
shape.
Summary
Functions
Execute an MCP-backed tool.
Functions
@spec execute(ExAthena.Tool.Spec.t(), map(), term()) :: {:ok, term()} | {:error, term()}
Execute an MCP-backed tool.
Honors the loop's tool_timeout_ms when carried in ctx.assigns[:tool_timeout_ms],
falling back to 30s otherwise. Calls the underlying Client directly (via a
pid resolved through the Server) so the per-server Server GenServer is not
blocked for the duration of the tool call.
Returns:
{:ok, content}—contentis the raw[%{"type" => ..., "text" => ...}]list; the loop stringifies it for the tool-result message.{:error, content}— server returnedis_error: true.{:error, {:mcp_server_not_running, server_name}}— the server is not registered or its pid is gone.{:error, error}—Client.call_tool/4returned an error.