# `ConduitMcp.Client.Tool`
[🔗](https://github.com/nyo16/conduit_mcp/blob/v0.11.0/lib/conduit_mcp/client/tool.ex#L1)

A tool advertised by one server, as the client holds it.

`raw` is the server's string-keyed tool definition, untouched: it is what
fingerprints are computed over and what LLM adapters read, and it keeps
keys this struct does not lift (`icons`, future fields). The other fields
are read-only conveniences lifted from `raw`:

  * `name`, `title`, `description`
  * `input_schema` (`inputSchema`), `output_schema` (`outputSchema`)
  * `annotations` - hints only. They are untrusted unless the server is
    configured as trusted, and never drive policy on their own.
  * `execution` - legacy task support (`execution.taskSupport`)
  * `meta` - the tool's `_meta`, or `%{}`

`server_id` is the operator-assigned id of the server that listed the tool
(never the self-reported `serverInfo.name`). `fingerprint` is the digest the
client pins approvals to; it is `nil` until the caller sets it.

# `t`

```elixir
@type t() :: %ConduitMcp.Client.Tool{
  annotations: map() | nil,
  description: String.t() | nil,
  execution: map() | nil,
  fingerprint: String.t() | nil,
  input_schema: map(),
  meta: map(),
  name: String.t(),
  output_schema: map() | nil,
  raw: map(),
  server_id: String.t(),
  title: String.t() | nil
}
```

# `display_name`

```elixir
@spec display_name(t()) :: String.t()
```

The display name, by the spec's precedence: `title`, then
`annotations.title`, then `name`.

# `from_wire`

```elixir
@spec from_wire(String.t(), term(), keyword()) ::
  {:ok, t()} | {:error, ConduitMcp.Client.Error.t()}
```

Builds a `Tool` from a wire `Tool` definition listed by `server_id`.

`name` must be a string and `inputSchema` an object; anything else is a
`:protocol` error with reason `:invalid_tool`. This checks shape only: the
name charset and `x-mcp-header` rules are enforced at tool intake.

## Options

  * `:fingerprint` - the value for the `fingerprint` field (default `nil`).

## Example

    iex> {:ok, tool} =
    ...>   ConduitMcp.Client.Tool.from_wire("files", %{
    ...>     "name" => "read",
    ...>     "inputSchema" => %{"type" => "object"}
    ...>   })
    iex> {tool.server_id, tool.name}
    {"files", "read"}

---

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