Skip to main content
Glama

Formally verify a Rego policy rule

rego_verify
Read-onlyIdempotent

Formally proves whether a Rego rule is always true, never true, or satisfiable; uses SMT solving to check all inputs and returns a counterexample when the property fails.

Instructions

Formally verify a property about a Rego rule using SMT solving (Microsoft Z3). Unlike testing, this checks ALL possible inputs and either proves the property holds or returns a concrete counterexample input that falsifies it. Supports equality, comparison, startswith, endswith, contains, and simple regex.match patterns (prefix: ^lit.*, suffix: .lit$, exact: ^lit$, contains: .lit., wildcard: .). Complex regex patterns (character classes, quantifiers, alternation) return INCONCLUSIVE. Also reports INCONCLUSIVE for negation-as-failure (not), comprehensions, partial set and object rules (deny contains msg), functions, else chains, and any operand it cannot encode. A body that reads an absent field is undefined rather than true, so always_true holds only if the rule is also true for an empty input: a rule requiring input.x will be answered with the counterexample {}.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
kindYesProperty to prove: always_true - rule is true for every possible input (finds inputs that violate this) never_true - rule is never true for any input (finds inputs that trigger it) satisfiable - at least one input exists where rule is true (returns a witness)
ruleYesName of the rule to verify (e.g. "allow", "deny").
sourceYesRego source to verify.

Schema Changelog

Changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. Addedv0.1.13

TDQS

A4.7/5.0
Behavior5/5

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

The description extensively discloses behaviors beyond the annotations: it returns concrete counterexamples, reports INCONCLUSIVE for specific unsupported constructs, treats absent fields as undefined, and explains the empty-input caveat for always_true. Annotations only declare read-only/idempotent, so this adds substantial value.

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

Conciseness5/5

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

The description is long but information-dense; every clause contributes a necessary limitation or behavioral detail. It is front-loaded with the core verification promise before moving to edge cases, making it efficiently scannable for an agent.

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

Completeness5/5

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

Despite having no output schema, the description covers all major outcomes: proof, counterexample, INCONCLUSIVE, unsupported language features, and undefined-field semantics. An agent has enough information to invoke the tool correctly and interpret likely results.

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%, so the baseline is 3. The description adds semantic depth beyond the schema by clarifying what always_true means for absent fields and how a rule requiring input.x yields the counterexample {}, which enriches the enum definitions in the schema.

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?

States a specific verb and resource: formally verify a property about a Rego rule using SMT solving. It clearly distinguishes itself from testing by checking ALL possible inputs and from sibling eval/test tools by emphasizing proof or counterexample output.

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

Usage Guidelines4/5

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

Gives clear context for when to use this tool: when exhaustive verification is desired instead of testing, and it explains when results will be INCONCLUSIVE due to unsupported constructs. It does not explicitly name sibling alternatives, but the 'Unlike testing' contrast and limitation list provide practical usage guidance.

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

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