ReqLLM. ToolResult
(ReqLLM v1.19.0)
View Source
ToolResult represents structured and multi-part tool outputs while keeping application-visible data separate from model-facing content.
outputis the original application value. Maps and lists remain available to local code and provider adapters without a text round trip.contentis the content sent back to the model. It may contain text orReqLLM.Message.ContentPartvalues for images and files. When omitted,ReqLLM.Contextderives model-facing text fromoutput.metadatacarries supplementary application or provider-native data. It is not a substitute for model-facing error or result content.
These fields may intentionally differ. For example, an application can keep a
rich JSON result in output while returning a concise explanation, an error,
or a multimodal file/image payload in content:
%ReqLLM.ToolResult{
output: %{document_id: "doc_123", page_count: 4},
content: [
ReqLLM.Message.ContentPart.text("The requested document is attached."),
ReqLLM.Message.ContentPart.file_id("file_123")
],
metadata: %{provider_native: %{request_id: "req_123"}}
}Tool callbacks retain their existing contract: return {:ok, result} for a
successful result or {:error, result} for an error. Either result may be a
plain text/JSON value or a ToolResult.
Summary
Functions
Returns whether a normalized tool message contains explicitly supplied result content.
Preserves a tool result's output and explicit-content provenance in message metadata.
Returns the Zoi schema for this module
Types
Functions
@spec explicit_content?(ReqLLM.Message.t() | map()) :: boolean()
Returns whether a normalized tool message contains explicitly supplied result content.
@spec metadata_key() :: atom()
@spec output_from_message(ReqLLM.Message.t() | map()) :: term() | nil
Preserves a tool result's output and explicit-content provenance in message metadata.
Returns the Zoi schema for this module