A fully-defined, executable tool that can be invoked by an LLM.
Bundles together a name, a natural-language description (shown to the model), a SchemaDefinition that describes the expected JSON parameters, and a handler function that performs the actual work.
Prefer constructing instances via ToolBuilder rather than directly.
Type parameters
R
Return type, must have a uPickle ReadWriter
T
Phantom type for the parameter schema (unused at runtime)
Value parameters
description
Natural-language description of what the tool does and when to use it
handler
Business logic; receives a SafeParameterExtractor and returns Right(result) or Left(errorMessage)
name
Unique tool identifier used by the LLM when calling the tool
schema
Parameter schema describing the expected JSON arguments
Executes the tool as the call call: the handler reads it as SafeParameterExtractor.call, so a tool with an external side effect can pass call.idempotencyKey on. An agent runs every ToolFunction this way.
Executes the tool as the call call: the handler reads it as SafeParameterExtractor.call, so a tool with an external side effect can pass call.idempotencyKey on. An agent runs every ToolFunction this way.