Tool result content block for messages.
Represents the result of a tool/action invocation. This maps to the LLM's tool_result blocks and contains the output from jido_action execution.
Fields
tool_use_id- The ID of the ToolUse this result corresponds tocontent- The result content (can be text, structured data, or error info)is_error- Whether this result represents an error
Example
ToolResult.new("call_123", "The weather in San Francisco is 72°F")
#=> %ToolResult{type: :tool_result, tool_use_id: "call_123", content: "The weather...", is_error: false}
ToolResult.new("call_456", "Tool not found: unknown_tool", true)
#=> %ToolResult{type: :tool_result, tool_use_id: "call_456", content: "Tool not found...", is_error: true}
Summary
Types
Functions
Creates a new tool result content block.
Parameters
tool_use_id- The ID of the ToolUse this result corresponds tocontent- The result content (string, map, or any term)is_error- Whether this result represents an error (default: false)
Examples
iex> ToolResult.new("call_1", %{results: [1, 2, 3]})
%ToolResult{type: :tool_result, tool_use_id: "call_1", content: %{results: [1, 2, 3]}, is_error: false}
iex> ToolResult.new("call_2", "Error: timeout", true)
%ToolResult{type: :tool_result, tool_use_id: "call_2", content: "Error: timeout", is_error: true}
Returns the Zoi schema for ToolResult content