# `AshAi.Tools`
[🔗](https://github.com/ash-project/ash_ai/blob/v0.6.1/lib/ash_ai/tools.ex#L5)

High-level API for discovering and building tools from Ash domains.

This module provides the main interface for working with AshAi tools.
It builds ReqLLM tools/registries and executes tool calls with consistent
JSON:API error formatting.

## Architecture

The tool functionality is organized into several specialized modules:
- `AshAi.Tool.Schema` - Generates JSON schemas for tool parameters
- `AshAi.Tool.Execution` - Executes Ash actions from tool calls
- `AshAi.Tool.Errors` - Formats errors as JSON:API responses
- `AshAi.Tool.Builder` - Creates ReqLLM.Tool structs and callbacks

# `build`

Builds a ReqLLM.Tool and callback from a tool definition.

Delegates to `AshAi.Tool.Builder.build/2`.

Returns `{ReqLLM.Tool, callback_fn}` tuple.

# `build_tools_and_registry`

Builds tools and a registry from options.

Returns `{[ReqLLM.Tool], %{name => callback}}` tuple.

# `execute`

Executes a tool with the given arguments and context.

Delegates to `AshAi.Tool.Execution.run/3`.

Returns `{:ok, json_result, raw_result}` on success or `{:error, json_error}` on failure.

# `list`

Returns a list of ReqLLM.Tool structs for the given options.

# `parameter_schema`

Returns the JSON Schema parameter schema for a tool definition.

Delegates to `AshAi.Tool.Schema.for_tool/1`.

# `registry`

Returns a registry map of tool names to callbacks.

---

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