Check Rego against a JSON Schema
rego_check_schemaValidate that Rego policy input field references match a JSON Schema. Returns structured diagnostics for mismatches with file/line locations.
Instructions
Validate that a Rego policy's input.* field references are consistent with a JSON Schema using opa check --schema. Every field the policy reads from input must exist in the schema; mismatches surface as rego_type_error diagnostics with file/line locations. Returns { valid: true, errors: [] } when all references match the schema, or { valid: false, errors: [...] } with structured diagnostics when they do not. Accepts the schema inline (pass the schema output of rego_infer_input_schema directly as inlineSchema) or as a path to an existing JSON Schema file on disk (schemaPath). Provide source for inline Rego or paths for file/directory checking.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | No | Inline Rego source to validate against the schema. Mutually exclusive with `paths`. | |
| paths | No | Filesystem paths to policy files or directories to validate. Each path must be inside an allowed root (OPA_MCP_ALLOWED_PATHS). Mutually exclusive with `source`. | |
| inlineSchema | No | JSON Schema (draft-07) object describing the expected shape of the `input` document. Mutually exclusive with `schemaPath`. Accepts the `schema` field from `rego_infer_input_schema` output directly. | |
| schemaPath | No | Path to a JSON Schema file on disk to use for `input` validation. Must be inside an allowed root (OPA_MCP_ALLOWED_PATHS). Mutually exclusive with `inlineSchema`. | |
| strict | No | Enable strict mode -- also fail on unused variables, deprecated builtins, and other non-fatal issues in addition to schema violations. |