-
Notifications
You must be signed in to change notification settings - Fork 2
Schema
Create strong API boundaries with our Enterprise-grade validation engine. By wielding Zod 3 for type-safety and natively supporting the Standard Schema specification, we guarantee flawless interoperability across all modern AI frameworks. Our Dual-Schema Pattern ensures strict .safeParse() execution, delivering "strict schema validation" and powering autonomous, self-healing agent workflows with confidence.
When building extensions or custom tools, adhere strictly to these Zod patterns:
-
Strict Validation: Always use
.strict()on root objects to prevent unrecognized properties from silently passing. -
Type Discrimination: Prefer discriminated unions (
z.discriminatedUnion) over simple unions (z.union) for predictable error reporting. -
Safe Parsing: Always use
schema.safeParse()instead of.parse()at I/O boundaries to avoid throwing exceptions and to gracefully handle invalid inputs.
To provide a secure and robust integration experience, we strictly enforce the following schemas at the MCP boundary:
-
Strict Error Responses: All tools are guaranteed to return a structured error response upon failure. All errors extend
MySQLMcpError(9 categories) and return enrichedErrorResponseviaformatHandlerError(). Our resilient design ensures you will never encounter raw, unhandled exceptions, empowering self-healing autonomous workflows. The schema is:{ success: false, error: string, code: string, category: string, suggestion: string, recoverable: boolean } -
Deterministic Table Queries: Tools that query tables will return
{ exists: false, table: string }if the table does not exist, enabling graceful fallback handling in your LLM workflows. -
Sandboxed File Operations: File system interactions are strictly bounded by
ALLOWED_IO_ROOTSto prevent directory traversal and ensure isolated, secure execution. -
Dual-Schema Pattern: Tools use a plain
z.object()Base schema for MCP parameter visibility, and az.preprocess()wrapper for handler parsing to support aliases and coercion without breaking standard JSON Schema generation.
Please refer to the repository source for Zod schemas (src/adapters/mysql/schemas/). We highly recommend using schema.safeParse() when building custom MCP tool execution handlers or client integrations to handle validation errors gracefully without throwing exceptions.
For runtime schema introspection, see the Code Mode documentation, which allows you to programmatically discover API parameters and return types using the .schema() introspection method.
Unlock autonomous database orchestration with an enterprise-grade MySQL MCP server. Featuring blazing-fast sandboxed Code Mode, uncompromising schema enforcement, and seamless ecosystem integrations to power secure, intelligent AI workflows.
- Installation
- Configuration
- Architecture
- HTTP Transport
- Tool Filtering
- Code Mode
- Tools
- Prompts
- Resources
- Observability & Telemetry