Skip to main content
Glama

Diff two Rego policies

rego_policy_diff
Read-onlyIdempotent

Evaluate the same query against two policies and compare results. Identifies if outputs are equal and shows differing paths for verifying refactor behavior.

Instructions

Evaluate the same query against two policies (or two versions of the same policy) and compare the results. Both evaluations run in parallel. Returns equal: true/false, the raw result from each side, and changedPaths -- the dot/bracket paths that differ. Useful for verifying that a refactor preserves behavior, or understanding exactly where two policies diverge. Each side takes either inline source (sourceA/sourceB) or a file/directory path (pathA/pathB). The same input and query are used for both evaluations.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceANoInline Rego source for policy A. Mutually exclusive with pathA.
pathANoFile or directory path for policy A. Must be inside an allowed root. Mutually exclusive with sourceA.
sourceBNoInline Rego source for policy B. Mutually exclusive with pathB.
pathBNoFile or directory path for policy B. Must be inside an allowed root. Mutually exclusive with sourceB.
queryYesThe query to evaluate against both policies, e.g. "data.example.allow".
inputNoInline input document (JSON). Mutually exclusive with inputPath.
inputPathNoPath to a JSON input file. Must be inside an allowed root. Mutually exclusive with input.
dataPathsNoAdditional data or policy paths loaded for both evaluations. Each must be inside an allowed root.
Behavior5/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the tool is safe. The description adds that evaluations run in parallel and details the return format ('equal: true/false', raw results, 'changedPaths'). This goes well beyond the annotations, providing full behavioral context.

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 three sentences, front-loading the core purpose and then detailing behavior and parameters. Every sentence adds value with no redundancy or filler.

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?

With 8 parameters, 1 required, and no output schema, the description covers return values, parameter relationships, and key behavioral traits. It lacks error conditions or edge cases but is sufficient for a diff tool.

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 description coverage is 100%, so baseline is 3. The description adds meaning by explaining mutual exclusivity between source/path pairs and that the same input and query are used for both evaluations. This enriches understanding beyond the schema alone.

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 evaluates the same query against two policies and compares results. It specifies the verb ('Evaluate' and 'compare'), the resources ('two policies or two versions'), and distinguishes from siblings by focusing on diffing rather than single evaluation.

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?

The description provides explicit use cases ('verifying that a refactor preserves behavior' and 'understanding exactly where two policies diverge') and explains parameter relationships (mutual exclusivity of sourceA/pathA). However, it does not explicitly state when not to use this tool or list alternatives among siblings.

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