Skip to main content
Glama
OrygnsCode

opa-mcp-server

Format Rego files in place

rego_format_write
DestructiveIdempotent

Canonically format Rego files or directories in place with version-specific options. Preview changes using dry run to avoid unintended modifications.

Instructions

Run opa fmt --write to canonically format one or more Rego files or directories in place. Use dryRun: true to preview which files would change without modifying them. Returns a list of files that were (or would be) reformatted. Unlike rego_format which returns formatted source as a string, this tool writes directly to disk. Supports regoV1, v0Compatible, and v1Compatible flags for version-specific formatting. If any file cannot be parsed, the operation is aborted and no files are written.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathsYesPolicy files or directories to format in place. Each must be inside an allowed root (OPA_MCP_ALLOWED_PATHS).
dryRunNoPreview which files would be reformatted without modifying them. Recommended before the first real run.
regoV1NoFormat module(s) to be compatible with both Rego v1 and the current OPA version. Adds `import rego.v1` where missing.
v0CompatibleNoUse OPA behaviors and syntax prior to the v1.0 release.
v1CompatibleNoUse OPA v1.0-compatible behaviors.
Behavior5/5

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

Annotations indicate destructiveHint=true and idempotentHint=true, which are consistent with the description's statement that the tool writes directly to disk. The description adds critical behavioral details not present in annotations, such as 'If any file cannot be parsed, the operation is aborted and no files are written' and the return of a list of reformatted files. This adds significant value beyond structured fields.

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 concise (3–4 sentences) and front-loads the primary action. Every sentence adds value: main purpose, dry-run usage, return value, distinction from sibling, version flags, and abort behavior. No extraneous information.

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 5 parameters, one required, and no output schema, the description covers the core behavior, safety precautions, dry-run mode, and return value ('list of files that were (or would be) reformatted'). It could elaborate slightly on the exact structure of the returned list, but overall it is sufficiently complete to guide an AI agent.

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?

The input schema has 100% description coverage, so each parameter is documented. The description mentions `dryRun`, version flags, and the allowed paths constraint, but largely echoes the schema. It does not add substantial new meaning beyond what the schema provides, so a baseline score of 3 is appropriate.

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 starts with 'Run `opa fmt --write` to canonically format one or more Rego files or directories in place', clearly specifying the verb (format), resource (Rego files/directories), and action (in place). It explicitly distinguishes from sibling `rego_format` which returns formatted source as a string, so the purpose is unambiguous and differentiates from alternatives.

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 advises using `dryRun: true` for previewing changes and warns that parsing failures abort the operation and leave no files written. It also mentions the `regoV1`, `v0Compatible`, and `v1Compatible` flags for version-specific formatting. While it does not explicitly state when not to use the tool, it provides sufficient context for appropriate usage.

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