Protocol
Schema
Learn how MCP schemas describe tool inputs and structured outputs, and why schema validation matters for generated MCP endpoints.
Definition
A schema is the machine-readable contract that describes a tool's accepted input, and sometimes its structured output. In MCP, schemas help the model form valid arguments and help the server reject invalid or unsafe calls.
How Astrail Uses It
Astrail generates schemas from OpenAPI, website forms, endpoint catalogs, and SDK metadata. Runtime validation treats the schema as an enforcement point, not just documentation.
Implementation Checklist
Prefer precise types, required fields, enums, and useful descriptions.
Keep generated schemas aligned with runtime validators.
Avoid permissive catch-all objects when the upstream API expects a narrow shape.
Document auth-required fields separately from user-provided arguments.
FAQ
Is a schema only for documentation?
No. A schema guides the model and should also drive server-side validation before a tool call reaches the upstream system.
Can MCP tools have output schemas?
Yes. Output schemas are useful when clients need predictable structured content rather than only free-form text results.