Skip to main content
MCP Apps SDK MCP tools use two related schema formats. In SDK code, you pass a runtime schema such as a Zod object. On the wire, clients receive JSON Schema 2020-12 in tools/list. This distinction matters because registerAppTool() does not accept a plain JSON Schema object as its runtime schema. It expects a schema library value that implements Standard Schema validation and the ~standard.jsonSchema interface. Use manual onlisttools and oncalltool handlers when you want to author the wire schemas and validation logic yourself.

Server Tool Schemas

Pass complete schema objects to registerAppTool(). Zod 4.2 or later implements both required Standard Schema interfaces.
The MCP server SDK performs these checks:
  1. It converts each registered schema to JSON Schema for tools/list.
  2. Before the callback runs, it validates and parses tools/call.arguments with inputSchema.
  3. After a successful callback, it requires structuredContent when outputSchema exists and validates that value. Tool results with isError: true are not checked against outputSchema.
If input or output validation fails, the callback is skipped or its successful result is replaced with a tool error result. The model can read that error and correct a later call.
A TypeScript type does not validate network input. Define inputSchema even if the callback argument already has a TypeScript annotation.

App-Side Tool Schemas

Views can expose tools with app.registerTool(). The same schema value supplies TypeScript inference, runtime validation, and the JSON Schema sent to the host.
app.registerTool() parses arguments before calling the handler. For successful results, it also parses structuredContent with outputSchema. A missing or invalid structured result rejects the tool call. Results marked isError: true bypass output validation. If you define app-side tools through onlisttools and oncalltool instead, return JSON Schema from onlisttools and validate params.arguments inside oncalltool. The low-level handlers do not add runtime validation for you.

Input Schema Rules

Every MCP tool definition has an object-shaped inputSchema, including tools without arguments. The SDK emits an empty object schema when you omit inputSchema, but an explicit schema documents intent and rejects unexpected fields when you use .strict():
Use descriptions and constraints that help a model form valid arguments:
Keep server authorization and business checks in the callback. A schema checks the shape and basic constraints of the input, but it does not prove that the caller may access a record or perform an action.

Output Schema Rules

Add outputSchema when a View or another client depends on structuredContent. The handler must then return matching data on every successful path.
Core MCP 2026-07-28 permits any JSON value at the root of structuredContent when the output schema permits it. Core MCP 2025-11-25 requires an object, so use an object root for MCP Apps that must work across both versions. See MCP structuredContent, content, and _meta for the compatibility rules. Keep a readable content block alongside structuredContent. Clients without a View still need a useful result, and the MCP specification recommends serialized JSON in a text block for backwards compatibility.

Standard Schema Requirements

The SDK reads two members from a compatible runtime schema:
  • ~standard.validate validates input and output values.
  • ~standard.jsonSchema.input() or .output() exports JSON Schema 2020-12.
Zod 4.2 or later, ArkType, and Valibot implement these interfaces. Older Zod versions do not meet the MCP SDK 2.x requirement. A plain object such as { type: 'object', properties: ... } is already wire JSON Schema, but it has no runtime validator or Standard Schema metadata, so do not pass it to registerAppTool() or app.registerTool(). The SDK 2.x server helper still accepts a raw Zod shape such as { query: z.string() }, but that overload is deprecated. Wrap the shape with z.object() so input and output schemas follow the same pattern.

Common Schema Errors

Test the Contract

Test the schema boundary without rendering the View:
Add a negative case for rejected input, and keep a success case for every handler branch that returns different structured data.

registerAppTool

Register a server tool that renders a View.

App-Side Tools

Let the host call tools exposed by a View.

Tool Results and Model Context

Decide what belongs in content, structuredContent, and _meta.

MCP Tools

Review the core tools/list and tools/call contract.
The MCP tools specification defines the wire-level JSON Schema and validation requirements. The MCP Apps SDK 2.0 migration guide lists the runtime schema requirements.