Skip to main content
Use inputSchema and outputSchema to define structured tool contracts in Redop.

What validation does in Redop

Redop uses schemas for two different jobs:
  • inputSchema validates and parses tool input before the handler runs
  • outputSchema describes structured output to MCP clients
That means:
  • inputSchema affects runtime execution
  • outputSchema affects metadata and structuredContent
  • outputSchema is not currently enforced against returned values at runtime

Basic example

What happens when validation fails

If inputSchema validation fails:
  • the handler does not run
  • Redop wraps the message with the tool name
  • the transport returns a tool error result with isError: true
This matches current MCP guidance for tool input validation errors. A typical error message looks like:
Depending on the schema library, you may get richer field-level output. For example, a Zod validation failure may produce a message shaped like:

Supported schema styles

Redop auto-detects supported schema styles per schema value. You can mix supported schema libraries across tools, and even use a different supported library for inputSchema and outputSchema on the same tool.

Zod

Zod is a strong default when you want ergonomic authoring and good type inference.

Standard Schema libraries

Redop supports libraries that implement the Standard Schema contract. That includes common options such as:
  • Zod
  • Valibot
  • ArkType
  • Effect Schema
  • Yup
  • Joi
  • other Standard Schema-compatible libraries

TypeBox

TypeBox is a good fit when you want JSON-Schema-first authoring and optional runtime validation through @sinclair/typebox/value.

Plain JSON Schema

You can also pass plain JSON Schema objects directly.
Important note:
  • plain JSON Schema is used directly for MCP metadata
  • plain JSON Schema does not currently perform runtime parsing or coercion by itself in Redop
If you need runtime enforcement, prefer a supported runtime-capable schema library such as Zod, Valibot, ArkType, or TypeBox.

Input schema vs output schema

Use inputSchema when you need:
  • runtime validation
  • type inference
  • defaults or coercion from the schema library
  • MCP input metadata
Use outputSchema when you need:
  • structured output metadata for clients
  • structuredContent on object results
  • a machine-readable result shape

Practical rules

  • use inputSchema for runtime input validation
  • use outputSchema for result metadata
  • prefer Zod or another Standard Schema library when you want runtime validation and strong types
  • use TypeBox when you want JSON-Schema-first authoring
  • use plain JSON Schema when you already have schema objects and only need metadata