Skip to main content
MCP Apps SDK

Overview

The ontoolinput notification handler is called when the host sends complete tool arguments. This event arrives after a tool call begins and before the tool result is available, giving your app a window to process or display the finalized input. Like all notification handlers, ontoolinput should be registered before calling connect() to ensure no events are missed during the initialization handshake.
Register handlers before calling connect() to avoid missing notifications during the initialization handshake.

Signature

Parameters

params.arguments
Record<string, unknown>
Complete tool call arguments as key-value pairs.

Usage

Basic usage

Rendering tool input in the UI

Using with the sunpeak framework

The sunpeak framework provides the useToolData hook, which wraps ontoolinput (along with related handlers) into a reactive value for React components. This is the recommended approach when building with sunpeak.