Skip to main content
useToolInfo reads the tool call that rendered the current view, so a view can display the data its own tool produced. Import it from your generated helpers.ts: the typed hook infers input, output, and responseMetadata from your server, so you pass only the tool name.

Example

The view reads the result of the tool that rendered it, branching on status.

Type Parameters

ToolSignature

Refines the shape of input, output, and responseMetadata. This is the direct-import form; the generated helper takes a tool name instead and infers all three. With neither, each typed field resolves to never.

Returns

status

  • "pending": the tool’s output and metadata have not arrived yet.
  • "success": the tool delivered its output or its responseMetadata.

isPending, isSuccess

Each is true when status equals the matching value and false otherwise. isIdle is also returned but deprecated, always false.

input

The arguments the view’s tool was called with. The model sees these: they are part of the tool call in the conversation. It can be undefined in either state, because the host may render the view before it delivers the arguments.

output

The tool’s structured output, set when status is "success". The model sees this: it is the tool result in the conversation. It is undefined while pending, and undefined in success if the tool returned no structured output.

responseMetadata

The _meta the tool’s handler returned alongside its result, typed from your server. It is undefined while pending, and undefined in success if the tool returned no metadata.

Create Views

Render a view from a tool result in context

generateHelpers

The typed useToolInfo that infers from your server

useCallTool

Call another tool from the view