Skip to main content
Interactions in a View can target the MCP server, the model, the host, or the mounted UI. Choose the API based on where the action should happen.

Call a server tool

Use useCallTool() when a button, form, or other control should call an MCP tool. The hook provides the last successful result, the latest error, and the current pending state. Export the tool reference returned by server.tool() so TypeScript can infer its input and output types in the View.
callTool() rejects when the tool returns an error or the request fails. The hook also places that failure in error so the View can render it.

Ask the model to continue

Use useSendFollowUp() when an action requires a new model turn. The prompt appears as a user-authored message in the conversation.
The promise resolves when the host accepts the message, not when the model responds. Use useCallTool() instead when the View already knows which server operation to perform. Views run in a sandbox. Use useOpenExternal() to ask the host to open a URL outside the View.
The host decides whether and how to open the URL. It may ask the user for confirmation.

Change the display mode

Use useDisplayMode() when a View needs more or less space. Only offer modes included in availableDisplayModes.
A display-mode request is advisory. Read displayMode for the mode the host actually applies.

Let the model act on the View

Use useViewTool() to expose an action that operates on the mounted UI. The tool exists while the component is mounted and its handler receives the latest React state.
useCallTool() lets the View call the server. useViewTool() lets the host or model call the mounted View.

Next steps