Toolnexus.ToolResult (toolnexus v0.17.0)

Copy Markdown View Source

Uniform tool result (SPEC §1). metadata.pending carrying a Request = suspension (§10).

parts carries non-text output (SPEC §1B) — an image, a PDF, an audio clip. output stays required and remains what the transcript, compaction, token estimation and any text-only provider see; a result setting no parts is byte-identical to pre-0.17.

Summary

Functions

Convenience: an error result with the given text.

Convenience: a success result with the given text.

True when this result is a §10 suspension (metadata.pending is a Request).

Types

t()

@type t() :: %Toolnexus.ToolResult{
  is_error: boolean(),
  metadata: map() | nil,
  output: String.t(),
  parts: [Toolnexus.ContentPart.t()] | nil
}

Functions

error(text)

@spec error(String.t()) :: t()

Convenience: an error result with the given text.

ok(text)

@spec ok(String.t()) :: t()

Convenience: a success result with the given text.

pending?(arg1)

@spec pending?(t()) :: boolean()

True when this result is a §10 suspension (metadata.pending is a Request).