Overview
registerAppTool is a convenience wrapper around the MCP SDK’s server.registerTool() that normalizes UI metadata for compatibility across hosts. Use it instead of registerTool when your tool should render a View.
Signature
Parameters
The MCP server instance.
Tool name/identifier.
Tool configuration. Extends the standard MCP
ToolConfig with a required _meta field containing UI metadata.Human-readable tool title.
Tool description for the model.
Zod schema or JSON Schema for tool arguments.
Zod schema or JSON Schema for tool output.
MCP tool annotations (e.g.,
readOnlyHint).Tool handler function. Receives parsed arguments and returns a
CallToolResult.Usage
Basic tool with UI
App-only tool (hidden from model)
Setvisibility: ["app"] for tools that should only be callable from the View — useful for polling, pagination, or UI-driven server interactions:
Model-only tool
Setvisibility: ["model"] for tools that the model can call but the View cannot:
Metadata Normalization
registerAppTool automatically normalizes between the current format (_meta.ui.resourceUri) and the deprecated flat key (_meta["ui/resourceUri"]) for backward compatibility with older hosts.