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

Normalizes tool call and tool result data for generated chat UIs.

`mix ash_ai.gen.chat` templates delegate to `extract/1` so the generated modules
stay small and the parsing behavior is centralized in AshAi.

Advanced apps can override the generated delegation seam:

    @chat_ui_tools MyApp.ChatUITools

# `extracted_tool_data`

```elixir
@type extracted_tool_data() :: %{
  tool_calls: [tool_call()],
  tool_results: [tool_result()]
}
```

# `tool_call`

```elixir
@type tool_call() :: %{
  id: String.t(),
  name: String.t(),
  arguments: map(),
  arguments_preview: String.t()
}
```

# `tool_result`

```elixir
@type tool_result() :: %{
  id: String.t(),
  name: String.t() | nil,
  content: term(),
  is_error: boolean(),
  content_preview: String.t()
}
```

# `extract`

```elixir
@spec extract(map() | struct()) ::
  {:ok, extracted_tool_data()} | {:error, Ash.Error.t()}
```

---

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