Input Schema (JSON Schema)
WebMCP uses JSON Schema for input validation:Common JSON Schema Types
String Properties
String Properties
email- Email addressuri- URI/URLdate- ISO 8601 datedate-time- ISO 8601 date-timeuuid- UUID string
Number Properties
Number Properties
Boolean Properties
Boolean Properties
Array Properties
Array Properties
Object Properties (Nested)
Object Properties (Nested)
Zod Schema (React)
When using React and TypeScript, Zod provides type-safe schema validation:Zod Schema Patterns
String Validation
String Validation
Number Validation
Number Validation
Enums and Literals
Enums and Literals
Arrays and Objects
Arrays and Objects
Optional and Nullable
Optional and Nullable
Schema Best Practices
Always add descriptions
Always add descriptions
Descriptions help AI agents understand how to use your tools:
Validate at the schema level
Validate at the schema level
Use schema validation instead of manual checks:
Use appropriate constraints
Use appropriate constraints
Apply relevant constraints to prevent invalid inputs:
Provide sensible defaults
Provide sensible defaults
Use default values for optional parameters:
Keep schemas focused
Keep schemas focused
Don’t make schemas overly complex. Split into multiple tools if needed:
