Skip to main content
Glama

Query OPA decision

opa_query_decision
Read-onlyIdempotent

Evaluate OPA decisions by POSTing input to a data path and returning the rule result; undefined paths return defined: false, not false.

Instructions

Evaluate a decision against the running OPA server. POSTs to the data path with {input} and returns whatever the rule produces, plus defined: false when the path produced no value, which OPA reports by leaving result out. Undefined is not false; a caller that treats it as false or as allow decides on something the policy never said. Use this to ask the server "given this input, what does data.X.allow say?"

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoDecision path under `data.`, e.g. "rbac/allow" or "rbac.allow".
inputNoInput document to evaluate against.
explainNoInclude a trace at the requested level.
metricsNoInclude metrics in the response.
segmentsNoPath as literal key segments, e.g. ["labels", "app.kubernetes.io/name"]. Use instead of `path` when a key contains a dot or a slash.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv0.5.0
    • addedInput schema / properties / segments
      Added value: +{
      +  "description": "Path as literal key segments, e.g. [\"labels\", \"app.kubernetes.io/name\"]. Use instead of `path` when a key contains a dot or a slash.",
      +  "items": {
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "minItems": 1,
      +  "type": "array"
      +}
    • removedInput schema / required
      Removed value: -[
      -  "path"
      -]
  2. Addedv0.1.13
  3. Removedv0.1.5
  4. Addedv0.1.2
  5. Removedv0.1.1
  6. First observedv0.1.0

TDQS

A3.6/5.0
Behavior4/5

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

Adds real value beyond annotations: it describes the POST semantics, the undefined-vs-false distinction, and how OPA signals undefined by omitting result. Annotations already cover readOnly/idempotent/destructive/openWorld, so the description correctly focuses on the semantics an agent could get wrong.

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?

Front-loads the core action, then the undefined caveat, then a usage framing. It's a bit dense and the example sentence is slightly redundant, but no sentence is wasted.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Covers the critical undefined-result trap, which is the main failure mode. But with no output schema and 5 parameters, it doesn't describe the response shape (e.g. result wrapping) or how explain/metrics affect the return, leaving some integration gaps.

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 schema already documents path, input, explain, metrics, and segments. The description mentions only input implicitly; it does not add syntax or selection guidance beyond the schema, so baseline 3 applies.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource: evaluate a decision against the running OPA server, and clarifies the "what does data.X.allow say?" semantics. It distinguishes itself somewhat from siblings like rego_eval, but it never names an alternative explicitly, so the differentiation is implicit.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Gives one concrete usage example (asking for what data.X.allow returns), which implies a context. But it does not say when to use this instead of rego_eval, rego_eval_with_explain, or rego_explain_decision, despite several adjacent siblings that overlap heavily.

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