Skip to main content
Glama

Explain why a Rego query is undefined

rego_explain_undefined
Read-onlyIdempotent

Explain why a Rego query evaluates to undefined by pinpointing which conditions block each rule, using combined evaluation, trace, and AST analysis.

Instructions

Diagnose why a fully-qualified Rego query (e.g. "data.authz.allow") produces no value. Combines a plain eval, a full-trace eval, and per-condition AST analysis to identify the exact body expression blocking each rule. Handles both runtime failures (trace-based) and indexer elimination (standalone condition eval). Returns a structured breakdown of which conditions blocked each rule plus a human-readable summary.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
queryYesFully-qualified rule reference to explain, e.g. "data.authz.allow". Must match the path you would pass to rego_eval.
sourceNoInline Rego source to analyse. Mutually exclusive with paths.
pathsNoPolicy .rego file paths to load. Mutually exclusive with source.
inputNoInput document (JSON value) for the query.
inputPathNoPath to an input JSON file.
Behavior4/5

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

Beyond the annotations (readOnly, idempotent), the description adds behavioral context: it combines plain eval, full-trace eval, and per-condition AST analysis, and handles both runtime failures and indexer elimination. It also states the output is a structured breakdown plus human-readable summary. No contradictions.

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 two front-loaded sentences that clearly state the purpose, methodology, and output. Every sentence earns its place; no redundant or verbose content.

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 5 parameters and no output schema, the description adequately explains the tool's functionality and return value (structured breakdown + summary). It covers the essential aspects for a diagnostic tool, though a bit more detail on output structure could be beneficial.

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 coverage is 100%, so the parameters are already documented. The description restates that 'query' is fully-qualified but does not add significant semantic detail beyond what the schema provides. Baseline 3 is appropriate.

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 title and description clearly state the tool's purpose: diagnosing why a fully-qualified Rego query produces no value. It uses specific verbs ('diagnose', 'explain') and distinguishes the tool from siblings like rego_eval and rego_explain_decision by focusing on undefined queries and incorporating both trace and AST analysis.

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

Usage Guidelines3/5

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

The description implies usage for undefined queries and describes the methodology (trace-based, indexer elimination) but does not explicitly state when to use this tool versus alternatives. There is no guidance on when not to use it or mention of alternative tools.

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