Skip to main content
Glama

Explain Rego decision

rego_explain_decision

Trace a Rego query to reveal why a policy decision was denied. Returns a structured trace with per-rule fired/not-fired summary so you can identify the exact rule causing the denial.

Instructions

Evaluate a Rego query with full tracing and return a structured trace plus per-rule fired/not-fired summary. Use this when you need to answer "why was this denied?" -- the agent reads the structured trace and narrates the cause without re-implementing the trace parser.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputNoInline input document.
pathsNoPolicy / data file or directory paths. Each must be inside an allowed root.
queryYesRego query to evaluate, e.g. "data.example.allow".
sourceNoInline Rego policy source. Mutually exclusive with `paths`.
partialNoRun partial evaluation rather than full evaluation.
unknownsNoRefs to treat as unknown during partial evaluation.
inputPathNoPath to a JSON input file. Mutually exclusive with `input`.
strictBuiltinErrorsNoTreat builtin errors as fatal instead of returning undefined.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.13
  2. Removedv0.1.5
  3. Addedv0.1.2
  4. Removedv0.1.1
  5. First observedv0.1.0

TDQS

A4.2/5.0
Behavior4/5

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

With only sparse annotations (readOnlyHint=false, openWorldHint=true), the description adds useful behavioral detail: full tracing, a structured trace result, per-rule fired/not-fired summary, and the agent's expected role in interpreting the output. It does not clarify the side-effect ambiguity from readOnlyHint=false, but it does not contradict the 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?

Two sentences with no filler. The first sentence states the core behavior and output; the second gives the concrete usage context and the agent's role. Every clause earns its place.

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 tool with 8 parameters and no output schema, the description conveys the essential purpose, output shape, and agent workflow. It could be slightly more complete about what the structured trace contains or how partial evaluation behaves, but the schema covers parameters and the use case is well specified.

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

Parameters3/5

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

Schema description coverage is 100%, so the input schema already documents all 8 parameters. The description adds no parameter-level meaning beyond confirming that a Rego query is evaluated, which is the expected baseline when the schema carries the parameter documentation.

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 states a specific action and resource: evaluate a Rego query with full tracing and return a structured trace plus per-rule fired/not-fired summary. It clearly differentiates from siblings like rego_eval and rego_explain_undefined by focusing on the 'why was this denied?' diagnostic use case.

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 explicitly says when to use the tool: when you need to answer 'why was this denied?' and want the agent to narrate the trace without re-implementing tracing logic. It does not name alternative tools or explicitly state when not to use it, but the intended context is clear.

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