Open Policy Agent · Capability

Query API

Query API. 3 operations. Lead operation: Execute a Simple Query. Self-contained Naftiko capability covering one Open Policy Agent business surface.

Run with Naftiko Open Policy AgentQuery API

What You Can Do

POST
Post — Execute a Simple Query
/v1
GET
Get — Execute an Ad-hoc Query (GET)
/v1/v1/query
POST
Post — Execute an Ad-hoc Query (POST)
/v1/v1/query

MCP Tools

execute-simple-query

Execute a Simple Query

read-only
execute-ad-hoc-query-get

Execute an Ad-hoc Query (GET)

read-only idempotent
execute-ad-hoc-query-post

Execute an Ad-hoc Query (POST)

read-only

Capability Spec

query.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Query API
  description: 'Query API. 3 operations. Lead operation: Execute a Simple Query. Self-contained Naftiko capability covering
    one Open Policy Agent business surface.'
  tags:
  - Open Policy Agent
  - Query API
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    OPEN_POLICY_AGENT_API_KEY: OPEN_POLICY_AGENT_API_KEY
capability:
  consumes:
  - type: http
    namespace: query
    baseUri: ''
    description: Query API business capability. Self-contained, no shared references.
    resources:
    - name: root
      path: /
      operations:
      - name: post
        method: POST
        description: Execute a Simple Query
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: pretty
          in: query
          type: boolean
          description: Format response for human readability
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-query
      path: /v1/query
      operations:
      - name: get
        method: GET
        description: Execute an Ad-hoc Query (GET)
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: q
          in: query
          type: string
          description: Ad-hoc query to execute (URL encoded)
          required: true
        - name: pretty
          in: query
          type: boolean
          description: Format response for human readability
        - name: explain
          in: query
          type: string
          description: Return query explanation
        - name: metrics
          in: query
          type: boolean
          description: Return query performance metrics
      - name: post
        method: POST
        description: Execute an Ad-hoc Query (POST)
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: pretty
          in: query
          type: boolean
          description: Format response for human readability
        - name: explain
          in: query
          type: string
          description: Return query explanation
        - name: metrics
          in: query
          type: boolean
          description: Return query performance metrics
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
  exposes:
  - type: rest
    namespace: query-rest
    port: 8080
    description: REST adapter for Query API. One Spectral-compliant resource per consumed operation, prefixed with /v1.
    resources:
    - path: /v1
      name: root
      description: REST surface for root.
      operations:
      - method: POST
        name: post
        description: Execute a Simple Query
        call: query.post
        with:
          pretty: rest.pretty
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/query
      name: v1-query
      description: REST surface for v1-query.
      operations:
      - method: GET
        name: get
        description: Execute an Ad-hoc Query (GET)
        call: query.get
        with:
          q: rest.q
          pretty: rest.pretty
          explain: rest.explain
          metrics: rest.metrics
        outputParameters:
        - type: object
          mapping: $.
      - method: POST
        name: post
        description: Execute an Ad-hoc Query (POST)
        call: query.post
        with:
          pretty: rest.pretty
          explain: rest.explain
          metrics: rest.metrics
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: query-mcp
    port: 9090
    transport: http
    description: MCP adapter for Query API. One tool per consumed operation, routed inline through this capability's consumes
      block.
    tools:
    - name: execute-simple-query
      description: Execute a Simple Query
      hints:
        readOnly: true
        destructive: false
        idempotent: false
      call: query.post
      with:
        pretty: tools.pretty
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: execute-ad-hoc-query-get
      description: Execute an Ad-hoc Query (GET)
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: query.get
      with:
        q: tools.q
        pretty: tools.pretty
        explain: tools.explain
        metrics: tools.metrics
      outputParameters:
      - type: object
        mapping: $.
    - name: execute-ad-hoc-query-post
      description: Execute an Ad-hoc Query (POST)
      hints:
        readOnly: true
        destructive: false
        idempotent: false
      call: query.post
      with:
        pretty: tools.pretty
        explain: tools.explain
        metrics: tools.metrics
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.