Module Content_block.Tool_result

Results from tool invocations.

type t

The type of tool result blocks.

val jsont : t Jsont.t

jsont is the Jsont codec for tool result blocks. Use Jsont.Json.encode jsont and Jsont.Json.decode jsont for serialization. Use Jsont.pp_value jsont () for pretty-printing.

val create : tool_use_id:string -> ?content:Jsont.json -> ?is_error:bool -> unit -> t

create ~tool_use_id ?content ?is_error () creates a new tool result block.

  • parameter tool_use_id

    The ID of the corresponding tool use block

  • parameter content

    Optional result content (can be string or array of content blocks)

  • parameter is_error

    Whether the tool execution resulted in an error

val tool_use_id : t -> string

tool_use_id t returns the ID of the corresponding tool use.

val content : t -> Jsont.json option

content t returns the optional result content as raw JSON.

val is_error : t -> bool option

is_error t returns whether this result represents an error.

val unknown : t -> Unknown.t

unknown t returns any unknown fields from JSON parsing.