Schema validation is the first server-side gate on every tool call. Before a Data Tool’sDocumentation Index
Fetch the complete documentation index at: https://docs.metabind.ai/llms.txt
Use this file to discover all available pages before exploring further.
handler runs or an Interactive Tool’s BindJS layout compiles, the platform checks that the AI’s input matches the Type’s declared schema. Bad input never reaches your code.
Where validation runs
properties block. The platform validates incoming MCP tool calls against this schema using a JSON Schema validator. The result is binary — pass or reject.
What gets validated
| Property feature | Validated |
|---|---|
| Required fields present | yes |
| Field types match | yes (string, number, boolean, array, etc.) |
enum values | yes |
min/max for numbers | yes |
minLength/maxLength for strings | yes |
minItems/maxItems for arrays | yes |
pattern for strings (regex) | yes |
Nested group properties | yes (recursive) |
array items match valueType | yes |
| Component allowlist (next gate) | separately, after schema |
What rejection looks like to the AI
When validation fails, the platform returns a structured error to the AI:What rejection looks like to the user
If the AI exhausts its retries and still can’t produce valid input, the user sees an error in the host’s conversation:Designing schemas the AI can satisfy
A few patterns:- Use
descriptionon every property. The AI reads descriptions to decide what to provide.searchTerm: "Term to search for"is much more discoverable thansearchTerm: "". - Use
enumwhen there’s a fixed set of valid values.status: "open" | "closed" | "pending"constrains the AI cleanly. - Default optional values. Mark fields as optional with sensible defaults rather than requiring the AI to always supply them.
- Avoid overly tight
patternconstraints. A regex that excludes valid AI outputs causes silent retries; relax the pattern unless the constraint is genuinely required. - Use
minLength/minItemsto prevent empty input. A tool that takes an empty array often does the wrong thing — fail at the schema instead.
Schema vs. handler validation
A common mistake: validating the same thing in both the schema and the handler. The schema runs first; if it passes, the handler can trust the input shape. So:Output schemas (Data Tools)
Data Tools also validate their output. Theoutput schema runs after the handler returns:
Component validation (Interactive Tools)
Interactive Tools validate two things:- The Type’s input schema (same as Data Tools).
- The component reference in the input is on the project palette and on the slot’s allowlist.
Versioning and schema evolution
Published packages are immutable. When you add a property, rename one, or change a type, you produce a new package version. Connected hosts pick up the new schema on their next list-tools call — so a schema change in production is visible to AIs within seconds of publishing. For breaking changes (renamed property, dropped enum value), bump the package’s MAJOR version. See Package versioning.Custom validation rules
If you need validation the JSON Schema vocabulary can’t express (cross-field constraints, lookups against external state), do it in your handler and throw a structured error:ToolError returns a clean error to the AI, similar to schema rejection.
Observability
Every schema rejection appears in the project’s audit log with:- Timestamp
- Tool name
- Input that was rejected
- Specific validation error
product_search calls fail with “limit must be ≤ 50,” your schema might be too strict for what the AI naturally produces.
Related
Component allowlists
The other server-side gate that runs after schema validation.
Audit logs
Per-call observability including validation rejections.
Tools and Types
How Type input schemas are derived from properties.
BindJS Reference
The full
properties syntax for declaring schemas.