LlmCall.ToolResult (llm_call v0.4.0)

Copy Markdown View Source

The result of a tool call, ready to send back to the model.

Adapters validate the identifier they need: some protocols require call_id, others (Gemini) require name. Content is text-only โ€” no protocol carries a non-text tool result โ€” so a wider type would promise what validation refuses.

is_error is carried where the protocol has a field for it: Anthropic's is_error and Gemini's error key. OpenAI Chat and Responses have no error flag on a tool result, so they send the content and drop the flag; that is the one drop docs/design.md ยง8.1 records for this struct. Put the failure in the content text on those two codecs.

Summary

Types

content()

@type content() :: [LlmCall.Content.Text.t()] | String.t()

t()

@type t() :: %LlmCall.ToolResult{
  call_id: String.t() | nil,
  content: content(),
  is_error: boolean(),
  name: String.t() | nil
}