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

The tools offered to an LLM, keyed by the name the model sees.

Built by `ConduitMcp.Client.Naming.build/2`. Every exposed name matches
`^[A-Za-z0-9_-]{1,64}$` (valid for Anthropic, OpenAI and Gemini) and maps
to exactly one `ConduitMcp.Client.Tool`.

Reverse lookup is a table lookup (`resolve/2` is a `Map.fetch/2`): an
exposed name is never split back into a server id and a tool name, so a
tool name containing `__` cannot be used to reach another server's tool.

`entries` keeps the build order (servers in the given order, then each
server's tools in listed order), which keeps the provider tool list stable
between turns and so helps prompt caching.

# `exposed_name`

```elixir
@type exposed_name() :: String.t()
```

# `t`

```elixir
@type t() :: %ConduitMcp.Client.ToolSet{
  by_name: %{required(exposed_name()) =&gt; ConduitMcp.Client.Tool.t()},
  by_tool: %{required({String.t(), String.t()}) =&gt; exposed_name()},
  entries: [{exposed_name(), ConduitMcp.Client.Tool.t()}]
}
```

# `entries`

```elixir
@spec entries(t()) :: [{exposed_name(), ConduitMcp.Client.Tool.t()}]
```

The `{exposed_name, tool}` pairs, in build order.

# `exposed_name`

```elixir
@spec exposed_name(t(), String.t(), String.t()) :: {:ok, exposed_name()} | :error
```

The exposed name of `server_id`'s tool `tool_name`, if it is in the set.

# `names`

```elixir
@spec names(t()) :: [exposed_name()]
```

The exposed names, in build order.

# `new`

```elixir
@spec new([{exposed_name(), ConduitMcp.Client.Tool.t()}]) :: t()
```

Builds a toolset from ordered `{exposed_name, tool}` pairs.

Exposed names must be unique; `ConduitMcp.Client.Naming.build/2` guarantees
that, so call this directly only with names you have already deduplicated.
Raises `ArgumentError` on a duplicate exposed name.

# `resolve`

```elixir
@spec resolve(t(), term()) :: {:ok, ConduitMcp.Client.Tool.t()} | :error
```

Looks up the tool behind a model-issued name.

`:error` means the name is unknown: the caller answers the model with an
error result and sends nothing to any server.

# `size`

```elixir
@spec size(t()) :: non_neg_integer()
```

The number of tools in the set.

---

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