Skip to main content
sunpeak API

Overview

The useToolData hook provides reactive access to both the tool’s input arguments and output data (structured content). It replaces the need for separate input/output hooks. The output field contains the data from your MCP tool’s structuredContent response.

Wraps ontoolinput · ontoolresult · ontoolcancelled

MCP Apps SDK reference

Import

Signature

Parameters

TInput
Fallback value when no input is available. Optional.
TOutput
Fallback value when no output is available. Optional.

Returns

Returns a ToolData<TInput, TOutput> object with the following fields:
TInput | null
The tool call arguments.
TInput | null
Streaming partial input during tool execution.
TOutput | null
The structured content from the tool result.
boolean
Whether the tool result indicates an error.
boolean
Whether the tool is still executing.
boolean
Whether the tool call was cancelled by the host or user.
string | null
Optional reason for cancellation, or null if not cancelled.

Usage