Skip to main content
Glama

Share Rego policy as a GitHub Gist

rego_playground_share

Publish a Rego policy as a secret GitHub Gist to share with teammates or create a reproducible example, returning direct URLs for OPA eval and Conftest, with input/query/data bundled as metadata.

Instructions

Share a Rego policy with teammates or create a reproducible example by publishing it as a GitHub Gist, secret unless public: true is passed, so only people holding the link can read it. Returns { gistUrl, rawPolicyUrl, id, public }: the gistUrl renders the policy with syntax highlighting on github.com; the rawPolicyUrl can be passed directly to OPA (opa eval -d <rawPolicyUrl> <query>) or used as a data source in Conftest. When query, input, or data are supplied, a metadata.json file is bundled into the Gist so recipients have the full evaluation context to reproduce results. Each call creates a new Gist -- use the returned id to reference it later. Requires GITHUB_TOKEN in the environment (GitHub personal access token with the "gist" scope); returns GITHUB_TOKEN_MISSING with setup instructions if unset.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dataNoData document as a JSON string. Stored in metadata.json alongside the policy file.
inputNoInput document as a JSON string. Stored in metadata.json alongside the policy file.
queryNoDefault query to evaluate against the policy, e.g. "data.authz.allow". Stored in metadata.json alongside the policy file.
policyYesRego source code to share (the contents of a .rego file).
publicNoMake the Gist public: listed on the account and searchable. Off by default, which creates a secret Gist that anyone holding the link can read but that is not listed anywhere.
descriptionNoShort description for the Gist (shown on github.com/gists).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.6.0
    • addedInput schema / properties / public
      Added value: +{
      +  "description": "Make the Gist public: listed on the account and searchable. Off by default, which creates a secret Gist that anyone holding the link can read but that is not listed anywhere.",
      +  "type": "boolean"
      +}
  2. Addedv0.1.17

TDQS

A4.4/5.0
Behavior5/5

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

Rich disclosure well beyond the annotations: the GITHUB_TOKEN environment requirement plus the GITHUB_TOKEN_MISSING failure mode, non-idempotency ('Each call creates a new Gist'), the secret-by-default privacy behavior, and return-field semantics (gistUrl vs rawPolicyUrl with concrete OPA/Conftest usage). All of this is consistent with readOnlyHint=false, openWorldHint=true, and idempotentHint=false — no contradiction.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Roughly 150 words, with the purpose front-loaded and each subsequent sentence carrying distinct information: privacy default, return format, OPA/Conftest integration, metadata bundling, non-idempotency, and auth requirement. Slightly long, but the density is justified given six parameters, external side effects, and an auth dependency — no sentence is wasted.

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 complex externally-visible write tool with no output schema, the description is complete: it states the return shape inline ({ gistUrl, rawPolicyUrl, id, public }), covers the auth prerequisite and its failure mode, discloses the side effect (new Gist per call), and explains the privacy default. An agent has everything it needs to invoke the tool and interpret the result.

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 baseline is 3: every parameter (data, input, query, policy, public, description) already has a thorough schema description. The prose adds connective value by explaining that supplying query/input/data triggers metadata.json bundling for reproducibility, but it does not need to and does not meaningfully re-explain individual parameters.

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 opens with a specific verb and resource: "Share a Rego policy with teammates or create a reproducible example by publishing it as a GitHub Gist." It states exactly what the tool does and for what ends. It is unambiguously distinct from all 50+ siblings — no other tool publishes to an external service or deals with Gists.

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 explicit trigger scenarios: sharing with teammates and creating a reproducible example, including the 'full evaluation context' benefit of bundling query/input/data. It does not name alternatives or state when-not-to-use, but no sibling performs this function, so exclusions would be low-value; the context is clear enough for an agent to select it correctly.

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