Skip to main content
Glama

Auto-fix Rego violations

rego_fix
Destructive

Automatically apply mechanical fixes to Rego files using Regal, with options to preview changes, disable specific rules, and handle uncommitted files.

Instructions

Run regal fix to automatically apply mechanical fixes for the five rules regal 0.30.0 supports: opa-fmt, use-rego-v1, use-assignment-operator, no-whitespace-comment, and directory-package-mismatch. Use dryRun: true to preview changes before modifying files. NOTE: directory-package-mismatch moves files to match their package path -- use disable: ["directory-package-mismatch"] to skip it. Files with uncommitted git changes require force: true. Requires regal.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
forceNoAllow fixing files that have uncommitted git changes, or when the project is not a git repository. Without this flag regal refuses to touch uncommitted files.
pathsYesPolicy files or directories to fix. Each must be inside an allowed root (OPA_MCP_ALLOWED_PATHS).
dryRunNoPreview what would be fixed without modifying any files. Recommended before the first real run.
enableNoEnable specific fix rules.
disableNoDisable specific fix rules. Useful to skip directory-package-mismatch if you do not want files moved.
configFileNoPath to a Regal config file (.regal/config.yaml).
ignoreFilesNoGlob patterns to exclude from fixing.
enableCategoryNoEnable all rules in a category.
disableCategoryNoDisable all rules in a category.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.1.13

TDQS

A4.7/5.0
Behavior5/5

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

The annotations already signal destructiveness and non-readonly, but the description adds valuable behavioral detail: it modifies files, can be previewed with dryRun, directory-package-mismatch moves files, uncommitted changes require force, and the regal binary must be installed. This goes well beyond what annotations alone 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?

The description is compact and front-loaded: the main action and rule list appear first, followed by the most important usage warnings and prerequisites. Every sentence conveys distinct operational information without repetition or 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 destructive file-modifying tool with nine parameters and no output schema, the description covers the critical operational context: prerequisites, preview capability, file-moving side effects, and force requirements. The full parameter detail is already handled by the 100% schema coverage, so nothing essential for correct invocation is missing.

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 description coverage is 100%, so the baseline is 3. The description adds meaningful parameter context by enumerating the exact rule names available to enable/disable, clarifying that directory-package-mismatch physically moves files, and explaining the force requirement in terms of uncommitted git changes. This exceeds the schema's minimal parameter notes.

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 specific action ('Run regal fix to automatically apply mechanical fixes') and the exact resource scope by listing the five supported rules. This makes it immediately understandable and distinguishable from siblings like rego_lint or rego_suggest_fix, even without naming them.

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 practical context for when to use dryRun, force, and disable for directory-package-mismatch, and it explicitly frames the tool as applying mechanical fixes. It does not name sibling alternatives such as rego_suggest_fix, so exclusion guidance is missing, but the conditions provided are clear enough for an agent to select it properly.

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