Skip to main content
Glama

Diff two Rego policies

rego_policy_diff

Run the same query against two Rego policies and compare results, showing equality status and exact changed paths. Verify refactors preserve behavior or pinpoint where policies diverge.

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
inputNoInline input document (JSON). Mutually exclusive with inputPath.
pathANoFile or directory path for policy A. Must be inside an allowed root. Mutually exclusive with sourceA.
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".
sourceANoInline Rego source for policy A. Mutually exclusive with pathA.
sourceBNoInline Rego source for policy B. Mutually exclusive with pathB.
dataPathsNoAdditional data or policy paths loaded for both evaluations. Each must be inside an allowed root.
inputPathNoPath to a JSON input file. Must be inside an allowed root. Mutually exclusive with input.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.13

TDQS

A4.2/5.0
Behavior3/5

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

The description adds useful behavioral context beyond annotations, such as parallel evaluation, shared input/query across both sides, and the return shape. However, with `readOnlyHint: false`, it does not clarify whether the tool has any side effects, and it does not disclose error behavior if one side fails to evaluate.

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 compact and well structured: purpose first, then return value and execution behavior, then use cases, then parameter modes. Every sentence contributes information an agent needs.

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?

For a complex tool with 8 parameters and no output schema, the description covers the main invocation patterns, return fields, and use cases. It could be more complete with an example or error-handling notes, but the essential context is present.

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, but the description adds meaningful grouping: sourceA/sourceB and pathA/pathB represent the two policy sides, and the same input and query are used for both evaluations. This clarifies the mental model beyond individual property 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 a specific action: evaluate the same query against two Rego policies and compare the results. It also names its unique output (`equal`, raw result per side, `changedPaths`), which distinguishes it from the many single-policy eval siblings.

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?

It explicitly gives use cases: verifying a refactor preserves behavior and understanding where two policies diverge. It does not name alternative tools or state when not to use it, but the guidance is clear enough for an agent to select it appropriately.

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