# `OzMcp.Structs.ToolChoice`
[🔗](https://github.com/oz-elixir/oz_mcp/blob/v0.9.0/lib/oz_mcp/structs/tool_choice.ex#L1)

Helper module used to build `ToolChoice` structure: how the model uses the
tools of a sampling request.

_(MCP protocol: 2025-11-25)_

The mode is `:auto` (the model decides, the default of the client),
`:required` (the model must call a tool) or `:none` (the model must not).

## Short example:

```elixir
%ToolChoice{} |> ToolChoice.mode(:required) |> ToolChoice.build()
```

Result:

```elixir
%{mode: "required"}
```

Specification: [ToolChoice](https://modelcontextprotocol.io/specification/2025-11-25/schema#toolchoice)

## Fields

| Field | Setter | Type | Required |
|---|---|---|---|
| `mode` | `mode/2` | mode() \| String.t() \| nil | no |

# `mode`

```elixir
@type mode() :: :auto | :required | :none
```

# `t`

```elixir
@type t() :: %OzMcp.Structs.ToolChoice{mode: mode() | String.t() | nil}
```

# `build`

```elixir
@spec build(t()) :: map()
```

# `mode`

```elixir
@spec mode(t(), mode() | String.t() | nil) :: t()
```

---

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