Skip to main content
Glama

Rego test coverage gaps

rego_coverage_gaps

Run OPA test coverage to identify uncovered Rego rules and branches. Files are sorted from least covered, and a threshold can filter the report to only those below a target coverage percentage.

Instructions

Run opa test --coverage and return a per-file breakdown of uncovered line ranges. Identifies which rules or branches are not yet exercised by tests. Files are sorted by coverage ascending so the worst-covered files appear first. Use threshold to limit the report to files below a target coverage percentage.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsYesTest directories or files. opa test looks for *_test.rego siblings of source files.
thresholdNoReport only files below this coverage percentage (0-100). When omitted, all files with uncovered ranges are reported.
runPatternNoRun only tests whose names match this regex.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.13

TDQS

A4.2/5.0
Behavior4/5

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

The description adds useful behavioral detail beyond the annotations: it states that files are sorted by coverage ascending and that the threshold limits the report. It also transparently states it invokes 'opa test --coverage.' With annotations being minimal and readOnlyHint false, this provides meaningful insight into the tool's execution and output behavior.

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 three sentences, each with a distinct purpose: the command and output, the purpose, and sorting/threshold behavior. There is no redundancy or filler; every sentence contributes to an agent's understanding.

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 no output schema, the description adequately explains the return value ('a per-file breakdown of uncovered line ranges') and the filtering/sorting behavior. It could be slightly more explicit about the exact structure of the returned data, but the essential information needed to call and interpret the tool is present.

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 baseline is 3. The description repeats the threshold behavior already present in the schema and does not add any additional meaning for paths or runPattern. It adds no new semantic value beyond what the schema already documents.

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 the exact verb and resource: 'Run opa test --coverage' and the specific output: 'a per-file breakdown of uncovered line ranges.' This distinguishes it from siblings like rego_test or rego_eval_with_coverage, which focus on running tests or evaluating coverage for specific expressions, not on identifying gaps in coverage.

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 clear context for when to use the tool: to identify rules or branches not yet exercised by tests. It also explains how to customize usage via the threshold parameter. However, it does not explicitly mention alternatives or state when not to use this tool, such as when you simply need to run tests without coverage analysis.

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