Overview
Register tools that your app provides to the host. This enables bidirectional tool calling — the host can call tools defined by the app, in addition to the app calling server tools viauseCallServerTool.
Import
Signature
AppToolsConfig
Array of tool definitions to register with the host.
onCallTool
(params: { name: string; arguments?: Record<string, unknown> }) => CallToolResult | Promise<CallToolResult>
required
Handler called when the host invokes one of this app’s tools. Return a
CallToolResult with the tool’s output.AppTool
Unique tool name.
Human-readable description of what the tool does.
JSON Schema for the tool’s input parameters.
Usage
How It Works
- Your app registers tools via
useAppToolswhen the component mounts. - The host discovers tools via the MCP
listtoolsprotocol. - When the host invokes a tool, your
onCallToolhandler is called with the tool name and arguments. - Your handler returns a
CallToolResultwhich the host uses in its next turn.
See Also
useCallServerTool
Call MCP server tools from your app (the other direction).