Normalized tool definition for LLM function-calling.
Represents a tool that an LLM can invoke, including its name, description, JSON Schema parameters, and the actual function to execute.
Summary
Functions
Creates a new tool with validated attributes.
Types
Functions
Creates a new tool with validated attributes.
Examples
iex> {:ok, tool} = ExAgent.Tool.new(name: "search", description: "Search the web", parameters: %{}, function: fn _ -> :ok end)
iex> tool.name
"search"
iex> ExAgent.Tool.new(description: "Search", parameters: %{}, function: fn _ -> :ok end)
{:error, "name is required"}
iex> ExAgent.Tool.new(name: "search", parameters: %{}, function: fn _ -> :ok end)
{:error, "description is required"}