# `ExAthena.Mcp.Tool`
[🔗](https://github.com/udin-io/ex_athena/blob/v0.7.1/lib/ex_athena/mcp/tool.ex#L1)

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.

# `execute`

```elixir
@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}` — `content` is the raw `[%{"type" => ..., "text" => ...}]`
    list; the loop stringifies it for the tool-result message.
  * `{:error, content}` — server returned `is_error: true`.
  * `{:error, {:mcp_server_not_running, server_name}}` — the server is not
    registered or its pid is gone.
  * `{:error, error}` — `Client.call_tool/4` returned an error.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
