Skip to main content
Glama

Formally verify a Rego policy rule

rego_verify
Read-onlyIdempotent

Formally verify properties of Rego rules (always_true, never_true, satisfiable) by checking all possible inputs using SMT solving. Returns counterexamples if property fails, or proves it holds.

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, and other unsupported constructs.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesRego source to verify.
ruleYesName of the rule to verify (e.g. "allow", "deny").
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)
Behavior5/5

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

Annotations already declare readOnlyHint, destructiveHint, idempotentHint, and openWorldHint. The description adds behavioral context: uses SMT solving, returns concrete counterexamples, and reports INCONCLUSIVE for unsupported constructs. 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.

Conciseness5/5

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

The description is appropriately sized and well-structured: first sentence summarizes core functionality, second contrasts with testing, then lists supported patterns, and ends with limitations. Every sentence adds distinct value, with no redundancy.

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 the tool's complexity, the description is comprehensive: purpose, behavior, supported patterns, and limitations are all covered. However, the output format is not explicitly described; the description implies a proof or counterexample but lacks details about the response structure. Despite this, the description is sufficient for an AI agent to understand usage.

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

Parameters5/5

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

Schema coverage is 100% with descriptions for all three parameters. The description adds extra meaning by detailing supported patterns (equality, comparison, startswith, etc.) and explaining the effect of each 'kind' value, which goes beyond the schema descriptions.

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?

The description clearly states the tool's purpose: 'Formally verify a property about a Rego rule using SMT solving (Microsoft Z3).' It distinguishes from testing by emphasizing exhaustive checking of all inputs. The verb 'verify' and resource 'Rego rule' are specific and align with the tool name.

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

Usage Guidelines5/5

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

The description explains when to use this tool: 'Unlike testing, this checks ALL possible inputs either proves the property holds or returns a concrete counterexample.' It also lists supported patterns and warns about unsupported constructs that return INCONCLUSIVE, providing clear guidance on limitations.

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