Skip to main content
Glama
OrygnsCode

opa-mcp-server

Check Rego against a JSON Schema

rego_check_schema
Read-onlyIdempotent

Validate 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

TableJSON Schema
NameRequiredDescriptionDefault
sourceNoInline Rego source to validate against the schema. Mutually exclusive with `paths`.
pathsNoFilesystem paths to policy files or directories to validate. Each path must be inside an allowed root (OPA_MCP_ALLOWED_PATHS). Mutually exclusive with `source`.
inlineSchemaNoJSON 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.
schemaPathNoPath 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`.
strictNoEnable strict mode -- also fail on unused variables, deprecated builtins, and other non-fatal issues in addition to schema violations.
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

Annotations (readOnly, idempotent) cover safety. Description adds behavioral details: returns structured diagnostics with file/line locations, uses 'opa check --schema', and explains error format. No contradiction with annotations.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Description is concise (~100 words) with clear structure: purpose first, then return format, then parameter options. No redundant sentences, earns its space.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 5 parameters, no output schema, but annotations present, description covers purpose, behavior, return format, parameter options, and mutual exclusivity. Could mention limitations (e.g., only checks input references), but overall complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100% with descriptions. Description adds meaning: hints at passing 'schema' output from rego_infer_input_schema directly, clarifies mutual exclusivity of source/paths and inlineSchema/schemaPath, and mentions allowed paths constraint.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

Description clearly states the tool validates Rego policy input references against a JSON Schema using 'opa check --schema', specifying verb+resource. It distinguishes from siblings like rego_check (general syntax) and rego_infer_input_schema (infers schema) by focusing on consistency validation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Description explains how to use inline schema vs path and source vs paths, but does not explicitly contrast with alternatives like rego_check or rego_infer_input_schema. Usage context is implied but not directive.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/OrygnsCode/opa-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server