Skip to contents

Registers a list of tools on the active hal() session so the model can call them. Each element may be an ellmer::ToolDef (e.g. from daisy::daisy_tools()) or a plain hal tool list with name / description / fun / parameters. Unlike hal_register_tool(), which builds a tool from a bare function's formals, this passes each element through the chat's tool normalizer, so pre-built ToolDefs keep their declared argument schema.

Usage

hal_register_tools(tools)

Arguments

tools

A list of tool definitions (ellmer::ToolDef objects or hal tool lists).

Value

Invisibly, the number of tools registered.

Examples

if (FALSE) { # \dontrun{
tools <- list(
  hal_tool(function(x, y) x + y, "add",
    description = "Add two numbers",
    types = list(x = "number", y = "number")
  ),
  hal_tool(function(path) readLines(path), "read_file",
    description = "Read a text file"
  )
)
hal_register_tools(tools)
} # }