pig/tool/execution

Pure tool execution.

Looks up a tool in the registry, parses the tool call’s JSON arguments into dynamic.Dynamic, and calls the handler. Returns structured errors for unknown tools, malformed JSON, or handler failures. Never crashes.

Values

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

Execute a tool call against the registry.

Parses arguments_json into dynamic.Dynamic before passing to the handler. Returns:

  • Ok(json.Json) on successful execution
  • Error(ToolError) for unknown tools, malformed args, or handler errors
Search Document