Skip to main content
Glama

Benchmark Rego query

rego_bench

Benchmark Rego queries against policies and input to identify slow rules. Uses OPA bench to return timing stats, iterations, ns/op, and allocation counts.

Instructions

Benchmark a Rego query against a policy + input with opa bench. Returns statistical timing data: iterations, ns/op, and allocation counts. Use this to spot slow rules.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
countNoNumber of times to repeat the benchmark (`--count N`). Defaults to OPA's built-in default of one. Above one, every repetition is returned in `runs`, `fastest` indexes the one the top-level figures come from, and `raw` is omitted since that document is in `runs`.
inputNoInline input document.
pathsNoPolicy / data paths to load. Each must be in an allowed root.
queryYesRego query to benchmark.
inputPathNoPath to a JSON input file.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.6.0
    • changedInput schema / properties / count / description
      Previous value: -"Number of times to repeat the benchmark (`--count N`). Defaults to OPA's built-in default of one. Every repetition is returned in `runs`; the top-level figures come from the fastest of them."New value: +"Number of times to repeat the benchmark (`--count N`). Defaults to OPA's built-in default of one. Above one, every repetition is returned in `runs`, `fastest` indexes the one the top-level figures come from, and `raw` is omitted since that document is in `runs`."
  2. Changed1 schema field changedv0.5.0
    • changedInput schema / properties / count / description
      Previous value: -"Number of benchmark iterations. Defaults to OPA's built-in default."New value: +"Number of times to repeat the benchmark (`--count N`). Defaults to OPA's built-in default of one. Every repetition is returned in `runs`; the top-level figures come from the fastest of them."
  3. Addedv0.1.13
  4. Removedv0.1.5
  5. Addedv0.1.2
  6. Removedv0.1.1
  7. First observedv0.1.0

TDQS

A3.8/5.0
Behavior3/5

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

Annotations (readOnlyHint: false, openWorldHint: true) provide minimal behavioral signal, so the description carries much of the burden. It discloses that it runs `opa bench` and returns timing data, but it does not clarify the side-effect profile despite readOnlyHint: false, nor warn that benchmarking repeats query execution and can be expensive. There is no contradiction with 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, each earning its place: action, return values, and use case. The primary verb is front-loaded in the first sentence, and there is zero 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?

For a moderate-complexity tool with no output schema, the description covers purpose, key return fields, and intended use case, while the schema handles parameter semantics. It could add a note about execution cost or a fuller description of the result document structure, but nothing critical is missing.

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%, and the `count` parameter's schema description already explains runs/fastest/raw behavior, so the description correctly avoids repeating parameter details. The phrase 'policy + input' loosely maps to paths/input/inputPath but adds no syntax or format information beyond what the schema already provides, matching the baseline.

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 uses a specific verb+resource ('Benchmark a Rego query against a policy + input') and names concrete outputs (iterations, ns/op, allocation counts), which separates it from siblings like rego_eval and rego_test. It does not explicitly name a competing sibling such as rego_eval_with_profile, but the statistical-timing return values make the distinction largely clear.

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?

'Use this to spot slow rules' gives a direct when-to-use signal tied to a concrete goal. It stops short of a 5 because it offers no exclusions or explicit alternatives — for instance, no guidance on when to prefer rego_eval_with_profile or rego_test instead.

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