Skip to main content
Glama

Migrate Rego to v1 syntax

rego_migrate_v1
Read-onlyIdempotent

Migrate Rego v0 policies to v1 syntax: auto-fixes reserved keywords and adds import rego.v1, then validates and reports remaining issues for manual resolution.

Instructions

Migrate Rego v0 source to Rego v1 syntax in two phases: (1) opa fmt --rego-v1 auto-fixes reserved keywords (if, contains, every, in in rule heads) and adds import rego.v1; (2) opa check --v1-compatible validates the migrated source and reports any remaining issues that cannot be auto-fixed (e.g. removed builtins, semantic conflicts). Returns the migrated source and a changed flag even when check finds remaining errors -- this lets you inspect what changed and fix the remainder manually. If the source is completely unparseable, returns INVALID_REGO.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sourceYesRego v0 source to migrate to Rego v1 syntax. `opa fmt --rego-v1` auto-fixes reserved keywords and adds `import rego.v1`; any remaining issues are returned in `errors` so you can resolve them manually.
Behavior5/5

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

The description adds significant behavioral context beyond annotations: it details the two-phase process, explains that the tool returns migrated source and a changed flag even when errors remain, and specifies handling of invalid input (INVALID_REGO). This aligns with annotations (readOnlyHint, idempotentHint) without contradiction.

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 (5 sentences) and front-loaded with the purpose. Each sentence adds distinct information: purpose, phases, return values, edge case. No wasted words.

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?

Given the tool's moderate complexity and no output schema, the description covers all essential aspects: input, process, output (migrated source, errors, INVALID_REGO), and behavior when errors remain. An agent has enough context to use the tool correctly.

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?

With 100% schema coverage, baseline is 3. The description adds value by explaining the parameter's purpose in context of migration, though the schema description already repeats tool behavior. The single parameter is well-documented.

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's purpose: migrate Rego v0 to v1 syntax. It specifies the two-phase process (auto-fix with opa fmt --rego-v1 and validation with opa check --v1-compatible) and differentiates from other rego tools by covering both formatting and checking.

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 explains when to use this tool (for migration) and what happens in each phase. It implicitly contrasts with siblings like rego_format and rego_check by describing combined functionality. However, it does not explicitly state when not to use it or list alternatives.

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