Skip to main content
Glama

Auto-fix Rego violations

rego_fix
DestructiveIdempotent

Automatically fix Rego policy files by applying mechanical fixes for five regal rules, including formatting and syntax improvements. Preview changes with dry run before modifying 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
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.
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.
configFileNoPath to a Regal config file (.regal/config.yaml).
disableNoDisable specific fix rules. Useful to skip directory-package-mismatch if you do not want files moved.
enableNoEnable specific fix rules.
disableCategoryNoDisable all rules in a category.
enableCategoryNoEnable all rules in a category.
ignoreFilesNoGlob patterns to exclude from fixing.
Behavior5/5

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

Beyond annotations (destructiveHint, idempotentHint), description discloses that directory-package-mismatch moves files, requires force for uncommitted changes, and suggests dryRun for safety. Fully transparent about mutating 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?

Two sentences plus a note, all essential. Front-loaded with main action and critical usage guidance. No fluff.

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?

No output schema, but the description covers what the tool does and key behavioral notes. Lacks explicit mention of return value (e.g., success/error messages), but for a fix tool this is minor. Overall sufficiently complete with given annotations and schema.

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 covers 100% of parameters with descriptions. The description adds value by explaining the practical implications of key parameters (dryRun, force, disable) in context, aiding correct usage beyond schema alone.

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 tool runs 'regal fix' to apply mechanical fixes and lists the five specific rules supported, distinguishing it from sibling tools like rego_lint or rego_format.

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?

Provides explicit guidance on using dryRun for preview, force for uncommitted files, and disabling directory-package-mismatch. Lacks explicit when-not-to-use advice, but the context is clear enough for correct invocation.

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/OrygnsCode/opa-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server