Skip to main content
Glama

Conftest verify

conftest_verify

Run test_* rules in *_test.rego files to verify your conftest policies are correct, returning per-file pass/fail results and NO_TESTS_FOUND when none exist.

Instructions

Run the test_* rules inside *_test.rego files within a conftest policy directory, verifying that the policies themselves are correct. Equivalent to opa test but using conftest's policy-loading machinery. Returns per-file pass/fail results, and NO_TESTS_FOUND when the directory holds no test rules. Requires conftest on PATH or CONFTEST_BINARY set; returns CONFTEST_NOT_FOUND otherwise. A policy that calls parse_config_file or parse_combined_config_files is refused unless the operator sets OPA_MCP_CONFTEST_FILE_READS: they read files outside the allowed folders.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {},
    "name": "conftest_verify"
  }
}

Input Schema

NameRequiredDescriptionDefault
dataNoPaths to data directories. Each must be inside an allowed root (OPA_MCP_ALLOWED_PATHS).
policyNoPath to the directory containing both the Rego policies and the `*_test.rego` test files. Must be inside an allowed root (OPA_MCP_ALLOWED_PATHS). Omit to use conftest's default `./policy` directory.
namespaceNoNamespace to verify. Omit to verify all namespaces.
v0CompatibleNoRead the policies as Rego v0 (`--rego-version v0`), the syntax before OPA 1.0: rules without `if`, `deny[msg] { ... }`. conftest reads v1 by default and refuses such a policy.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.8.0
    • addedInput schema / properties / v0Compatible
      Added value: +{
      +  "description": "Read the policies as Rego v0 (`--rego-version v0`), the syntax before OPA 1.0: rules without `if`, `deny[msg] { ... }`. conftest reads v1 by default and refuses such a policy.",
      +  "type": "boolean"
      +}
  2. Changed1 schema field changedv0.6.0
    • changedInput schema / properties / namespace / description
      Previous value: -"Namespace to verify. Defaults to `main`. Omit to verify all namespaces."New value: +"Namespace to verify. Omit to verify all namespaces."
  3. Addedv0.1.13

TDQS

A4.5/5.0
Behavior5/5

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

Goes well beyond the annotations by disclosing prerequisites (`conftest` on PATH or `CONFTEST_BINARY`), the failure signal `CONFTEST_NOT_FOUND`, the empty case `NO_TESTS_FOUND`, the per-file result shape, and a concrete refusal condition for policies using parse_config_file unless OPA_MCP_CONFTEST_FILE_READS is set. That last point discloses a non-obvious security gate the annotations do not convey.

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?

Four tight sentences, front-loaded with the core action, then equivalence, then return values, then prerequisites and the refusal caveat. Every sentence carries information an agent could act on; nothing is filler.

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

Completeness5/5

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

For a zero-required-parameter verification tool with no output schema, the description covers what it does, how it signals success/failure/empty, environment prerequisites, and an important safety restriction. An agent has everything needed to decide whether to call it and how to interpret a refusal.

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 four parameters are already well documented, and the description adds no per-parameter detail such as path syntax or default resolution beyond the schema. The baseline of 3 applies: the schema does the heavy lifting and the description neither compensates nor detracts.

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?

States a specific verb and resource: run `test_*` rules inside `*_test.rego` files in a conftest policy directory, and explicitly frames it as verifying the policies themselves rather than exercising them against inputs. The `opa test` equivalence gives an agent an immediate mental model that separates it from sibling `conftest_test`.

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?

Clearly establishes the use case (checking that policies are correct) and distinguishes it conceptually from `opa test` and from running policies against configs via the 'policies themselves' framing. It does not name sibling `conftest_test` as the alternative for actually evaluating policies against input files, so the routing guidance is implied rather than explicit.

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