Skip to main content
FastMCP uses the Standard Schema specification for defining tool parameters. This allows you to use your preferred schema validation library (Zod, ArkType, or Valibot) as long as it implements the spec.

Supported libraries

FastMCP supports any validation library that implements the Standard Schema specification:

Zod

Most popular TypeScript-first schema validation

ArkType

TypeScript’s 1:1 validator

Valibot

Modular and type-safe schema library

Using Zod

Zod is the most popular choice and comes with excellent TypeScript support:

Using ArkType

ArkType provides 1:1 TypeScript syntax for runtime validation:

Using Valibot

Valibot is a modular, lightweight alternative with a functional API:
Valibot requires the peer dependency @valibot/to-json-schema.

Tools without parameters

When creating tools that don’t require parameters, you have two options:
Both approaches are fully compatible with all MCP clients, including Cursor. FastMCP automatically generates the proper schema in both cases.

Type inference

All schema libraries provide automatic TypeScript type inference for the execute function:

Complex schemas

You can use all features of your chosen schema library:

Validation errors

When a client passes invalid parameters, FastMCP automatically handles validation errors and returns them to the client:

Next steps

Tools

Learn more about tool definitions

Error Handling

Handle errors in your tools