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 onstatus.
Type Parameters
ToolSignature
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 itsoutputor itsresponseMetadata.
isPending, isSuccess
true when status equals the matching value and false otherwise. isIdle is also returned but deprecated, always false.
input
undefined in either state, because the host may render the view before it delivers the arguments.
output
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
_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 serveruseCallTool
Call another tool from the view