detect_schema_drift
Detects differences between a Zod schema and an OpenAPI spec, highlighting missing or extra fields, type conflicts, and required/optional mismatches to prevent contract drift.
Instructions
Compare a Zod schema in a TypeScript file against an OpenAPI spec — finds silent divergence. Use when Zod and OpenAPI docs are maintained separately and may have drifted apart. Reports missing fields, extra fields, type conflicts, and required/optional mismatches.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"zod_file_path": "<zod_file_path>",
"schema_export_name": "<schema_export_name>",
"openapi_file_path": "<openapi_file_path>"
},
"name": "detect_schema_drift"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| zod_file_path | Yes | Absolute path to the .ts or .js file containing the Zod schema | |
| openapi_file_path | Yes | Absolute path to the OpenAPI spec (.yaml, .yml, or .json) | |
| schema_export_name | Yes | Name of the exported Zod schema variable (e.g. "UserSchema") | |
| openapi_schema_name | No | Schema name in components.schemas to compare against. Defaults to schema_export_name. |