# `Ollixir.Tool`
[🔗](https://github.com/nshkrdotcom/ollixir/blob/main/lib/ollixir/tool.ex#L1)

Tool definition helpers for function calling.

Provides utilities to define tools declaratively and convert
Elixir functions to tool definitions.

# `param_opts`
[🔗](https://github.com/nshkrdotcom/ollixir/blob/main/lib/ollixir/tool.ex#L10)

```elixir
@type param_opts() :: [
  type: param_type(),
  required: boolean(),
  description: String.t(),
  enum: [any()],
  default: any(),
  items: param_opts()
]
```

# `param_type`
[🔗](https://github.com/nshkrdotcom/ollixir/blob/main/lib/ollixir/tool.ex#L9)

```elixir
@type param_type() :: :string | :integer | :number | :boolean | :array | :object
```

# `tool_def`
[🔗](https://github.com/nshkrdotcom/ollixir/blob/main/lib/ollixir/tool.ex#L19)

```elixir
@type tool_def() :: %{
  type: String.t(),
  function: %{
    name: String.t(),
    description: String.t() | nil,
    parameters: map()
  }
}
```

# `define`
[🔗](https://github.com/nshkrdotcom/ollixir/blob/main/lib/ollixir/tool.ex#L32)

```elixir
@spec define(
  atom() | String.t(),
  keyword()
) :: tool_def()
```

Define a tool with a name, description, and parameters.

# `from_function`
[🔗](https://github.com/nshkrdotcom/ollixir/blob/main/lib/ollixir/tool.ex#L51)

```elixir
@spec from_function(function()) :: {:ok, tool_def()} | {:error, term()}
```

Create a tool definition from a function reference.

# `from_mfa`
[🔗](https://github.com/nshkrdotcom/ollixir/blob/main/lib/ollixir/tool.ex#L73)

```elixir
@spec from_mfa(module(), atom(), non_neg_integer()) ::
  {:ok, tool_def()} | {:error, term()}
```

Create a tool definition from module, function name, and arity.

# `prepare`
[🔗](https://github.com/nshkrdotcom/ollixir/blob/main/lib/ollixir/tool.ex#L96)

```elixir
@spec prepare([function() | tool_def()]) :: {:ok, [tool_def()]} | {:error, term()}
```

Convert a list that may contain functions to tool definitions.

# `prepare!`
[🔗](https://github.com/nshkrdotcom/ollixir/blob/main/lib/ollixir/tool.ex#L109)

```elixir
@spec prepare!([function() | tool_def()]) :: [tool_def()]
```

Same as prepare/1 but raises on error.

---

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