OzMcp.Structs.ToolChoice (OzMcp v0.9.0)

Copy Markdown View Source

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:

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

Result:

%{mode: "required"}

Specification: ToolChoice

Fields

FieldSetterTypeRequired
modemode/2mode() | String.t() | nilno

Summary

Types

mode()

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

t()

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

Functions

build(struct)

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

mode(struct, value)

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