Documentation Index
Fetch the complete documentation index at: https://docs.skybridge.tech/llms.txt
Use this file to discover all available pages before exploring further.
useRegisterViewTool registers a view-provided tool — a tool whose handler
runs inside the view rather than on the MCP server. The host discovers it via
tools/list and invokes it via tools/call, and your handler executes against
the view’s live state. This is the MCP Apps “app-provided
tools” feature.
It is the mirror image of useCallTool: with
useCallTool the view calls a server tool; with useRegisterViewTool the
view exposes a tool for the model to call.
View tools are an MCP Apps feature. The ChatGPT Apps SDK
(
window.openai) runtime has no equivalent, so on that runtime
useRegisterViewTool is a no-op (a warning is logged). Use it when targeting
MCP Apps hosts.Basic usage
inputSchema before the handler runs, and the
handler receives them fully typed.
Parameters
config
registerTool config.
name— Unique tool name. Prefer namespacing (e.g.chess_make_move) so it never collides with a server tool.description— Written for the model, which decides when to call the tool.inputSchema— A Zod raw shape describing the arguments. Validated before the handler runs; surfaced to the host as JSON Schema.annotations— MCP tool annotations such asreadOnlyHintanddestructiveHint.
handler
args is typed from
config.inputSchema. Return a standard MCP CallToolResult — content
blocks plus optional structuredContent and _meta (forwarded to the host
verbatim, same as a server tool result). Set isError: true to report a
failure to the model.
The handler is always read from the latest render, so it sees current state
without forcing a re-registration.
Behavior
- The tool is (re)registered when
config.namechanges. Keep the name stable and the schema fixed for the tool’s lifetime. - Arguments are validated against
inputSchemabefore your handler runs; invalid input is rejected by the runtime and the handler is not called. - Each registration / removal notifies the host via
notifications/tools/list_changed.
Example: a chess move tool
chess example
for a full app built around view tools.