Overview
callServerTool lets the View invoke any tool registered on the originating MCP server. The host proxies the request to the server and returns the result. This is the primary mechanism for UI-driven server interactions — for example, fetching data, submitting forms, or triggering server-side actions from a button click.
Tool-level execution errors are returned inside the result object with isError: true rather than throwing exceptions. Only transport or protocol failures throw. Always check result.isError before consuming the response.
For tools that should only be callable from the View (not the model), register them with visibility: ["app"] on the server side. See registerAppTool for details.
Signature
Parameters
Optional request configuration.
An
AbortSignal to cancel the request.Returns
The result returned by the server tool.
Array of content blocks returned by the tool (text, images, embedded resources, etc.).
Structured output if the tool defines an
outputSchema. Parsed and validated by the server.true if the tool handler returned an error. When true, inspect content for error details. When false or absent, the call succeeded.Usage
Basic tool call
Using structured content
When the server tool defines anoutputSchema, the parsed result is available on structuredContent:
Cancelling a request
Pass anAbortSignal to cancel long-running tool calls:
Tool-level execution errors are returned in the result with
isError: true rather than throwing exceptions. Transport or protocol failures throw. Always check result.isError.Related
- Requests overview — all available View-to-host request methods
useCallServerTool— sunpeak React convenience hook- registerAppTool — register tools on the server with UI metadata
- Tool
_meta— visibility and metadata configuration