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 parametersAshAi.Tool.Execution- Executes Ash actions from tool callsAshAi.Tool.Errors- Formats errors as JSON:API responsesAshAi.Tool.Builder- Creates ReqLLM.Tool structs and callbacks
Summary
Functions
Builds a ReqLLM.Tool and callback from a tool definition.
Builds tools and a registry from options.
Executes a tool with the given arguments and context.
Returns a list of ReqLLM.Tool structs for the given options.
Returns the JSON Schema parameter schema for a tool definition.
Returns a registry map of tool names to callbacks.
Functions
Builds a ReqLLM.Tool and callback from a tool definition.
Delegates to AshAi.Tool.Builder.build/2.
Returns {ReqLLM.Tool, callback_fn} tuple.
Builds tools and a registry from options.
Returns {[ReqLLM.Tool], %{name => callback}} tuple.
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.
Returns a list of ReqLLM.Tool structs for the given options.
Returns the JSON Schema parameter schema for a tool definition.
Delegates to AshAi.Tool.Schema.for_tool/1.
Returns a registry map of tool names to callbacks.