Urchin.Result.CallTool (Urchin v0.2.0)

Copy Markdown View Source

An explicit tools/call result.

Handlers usually return {:ok, content} and let the dispatcher build this, but they may construct it directly to set structured_content or is_error.

Summary

Functions

Builds an error result (isError: true) from a list of content blocks.

Builds a successful result from a list of content blocks.

Serializes to the CallToolResult wire shape.

Types

t()

@type t() :: %Urchin.Result.CallTool{
  content: [map()],
  is_error: boolean(),
  structured_content: map() | nil
}

Functions

error(content)

@spec error([map()]) :: t()

Builds an error result (isError: true) from a list of content blocks.

ok(content, opts \\ [])

@spec ok(
  [map()],
  keyword()
) :: t()

Builds a successful result from a list of content blocks.

to_map(result)

@spec to_map(t()) :: map()

Serializes to the CallToolResult wire shape.