Skip to main content
Glama

Partially evaluate a Rego query

rego_compile_query

Run partial evaluation on a Rego query to substitute known values and return the residual policy, enabling offline policy slicing or pre-computing decision sets.

Instructions

Run partial evaluation on a query -- substitute known values and return the residual policy. Defaults unknowns to ["input"] (treat input as unknown), so the residual encodes "given input X, this is what would have to be true." Use this for offline policy slicing or pre-computing decision sets.

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/5.0
Behavior4/5

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

The description clearly discloses the key behavioral trait: unknowns defaults to ["input"] and the residual policy encodes a conditional implication. It also explains the open-world framing of 'given input X...' beyond the readOnlyHint/openWorldHint annotations. It does not discuss side effects or error behavior, but nothing contradicts 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?

Three sentences with no filler; the core operation is front-loaded and each sentence adds either behavior or usage guidance. The structure is easy to scan.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description explains the central behavior and use case, but omits how the residual policy is returned/formatted and does not reconcile with the `partial` boolean parameter, which can disable partial evaluation. With no output schema and eight parameters, that leaves some ambiguity for an agent deciding how to call and interpret the result.

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 schema already documents all eight parameters. The description adds meaningful semantics by explaining the `unknowns` default and the substitution behavior that makes partial evaluation useful.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description names a specific operation, "Run partial evaluation on a query," and an output, "the residual policy," so an agent can understand what the tool does. It does not explicitly distinguish it from the closely named sibling opa_compile_query, though the partial-evaluation framing implies the difference.

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 gives concrete use cases: "offline policy slicing or pre-computing decision sets," which tells an agent when this tool is appropriate. It does not state when not to use it or name alternative siblings, so it falls short of fully explicit routing.

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