Overview
Theontoolinputpartial notification handler receives best-effort tool arguments while the host is still generating a tool call. Use it to show a preview before the complete input arrives.
The host may recover incomplete JSON by closing open brackets or braces before sending each notification. The resulting arguments object is valid JSON, but fields can be missing, truncated, replaced, or removed by a later notification.
Like all notification handlers, ontoolinputpartial should be registered before calling connect().
Event Order
For one tool call, the host sends events in this order:- Zero or more
ui/notifications/tool-input-partialnotifications while arguments stream. - At most one
ui/notifications/tool-inputnotification with the complete arguments. The host stops sending partials after this event. - A
ui/notifications/tool-resultorui/notifications/tool-cancellednotification.
Signature
Parameters
Record<string, unknown>
Best-effort tool arguments recovered from incomplete JSON. Fields may be missing or change between notifications.
Usage
Basic preview rendering
Progressive rendering with a final state
Combineontoolinputpartial for live preview with ontoolinput for the finalized result:
Using with the sunpeak framework
The sunpeak framework provides theuseToolData hook. Partial and complete arguments use separate fields so preview state cannot overwrite finalized input.
inputPartial updates as partial notifications arrive. When the complete input arrives, sunpeak sets input, clears inputPartial, and keeps the final arguments available for the rest of the tool lifecycle.
Test Streaming Input Locally
Runsunpeak dev, open Tool Input in the inspector sidebar, edit the JSON, and click Send as Partial (Streaming). Check that your View:
- Renders missing and incomplete fields without throwing.
- Does not trigger tool calls or other side effects from a partial event.
- Replaces the preview when complete input or cancellation arrives.
Related
- Event Handlers overview for all notification and request handlers
- MCP App lifecycle for event ordering from initialization through teardown
- MCP Apps security for rendering untrusted tool data