pig/tool/execution

Tool execution compatibility API and batch validation.

execute_tool delegates to the canonical dispatch in pig/tool; batch validation remains here because it is used by the agent runtime.

Values

pub fn execute_tool(
  registry: tool.ToolRegistry,
  call: message.ToolCall,
) -> Result(json.Json, tool.ToolError)

Execute a tool call through canonical registry dispatch.

This compatibility API delegates to tool.execute_tool, which owns lookup, argument decoding, context construction, and handler invocation.

pub fn validate_tool_calls(
  calls: List(message.ToolCall),
) -> Result(Nil, tool.ToolCallBatchError)

Validate a batch before hooks, telemetry, or tool processes are started.

The first invalidity is selected left-to-right: an empty ID at its index, or the second occurrence of a duplicated ID. Empty batches are valid.

Search Document