Skip to main content
sunpeak API

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 via useCallServerTool.

Wraps oncalltool · onlisttools

MCP Apps SDK reference

Import

Signature

AppToolsConfig

tools
AppTool[]
required
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

name
string
required
Unique tool name.
description
string
Human-readable description of what the tool does.
inputSchema
Record<string, unknown>
JSON Schema for the tool’s input parameters.

Usage

How It Works

  1. Your app registers tools via useAppTools when the component mounts.
  2. The host discovers tools via the MCP listtools protocol.
  3. When the host invokes a tool, your onCallTool handler is called with the tool name and arguments.
  4. Your handler returns a CallToolResult which the host uses in its next turn.

See Also

useCallServerTool

Call MCP server tools from your app (the other direction).