Trino · Capability

Trino Client REST API — Queries

Trino Client REST API — Queries. 4 operations. Lead operation: List Active Queries. Self-contained Naftiko capability covering one Trino business surface.

Run with Naftiko TrinoQueries

What You Can Do

GET
Listqueries — List Active Queries
/v1/v1/query
POST
Submitstatement — Submit SQL Statement
/v1/v1/statement
GET
Getqueryresults — Get Query Results
/v1/v1/statement/{queryid}/{token}
DELETE
Cancelquery — Cancel Query
/v1/v1/statement/{queryid}/{token}

MCP Tools

list-active-queries

List Active Queries

read-only idempotent
submit-sql-statement

Submit SQL Statement

get-query-results

Get Query Results

read-only idempotent
cancel-query

Cancel Query

idempotent

Capability Spec

client-queries.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Trino Client REST API — Queries
  description: 'Trino Client REST API — Queries. 4 operations. Lead operation: List Active Queries. Self-contained Naftiko
    capability covering one Trino business surface.'
  tags:
  - Trino
  - Queries
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    TRINO_API_KEY: TRINO_API_KEY
capability:
  consumes:
  - type: http
    namespace: client-queries
    baseUri: http://{host}:{port}
    description: Trino Client REST API — Queries business capability. Self-contained, no shared references.
    resources:
    - name: v1-query
      path: /v1/query
      operations:
      - name: listqueries
        method: GET
        description: List Active Queries
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: state
          in: query
          type: string
          description: Filter queries by state
        - name: limit
          in: query
          type: integer
          description: Maximum number of queries to return
    - name: v1-statement
      path: /v1/statement
      operations:
      - name: submitstatement
        method: POST
        description: Submit SQL Statement
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: X-Trino-User
          in: header
          type: string
          description: The user identity submitting the query
          required: true
        - name: X-Trino-Catalog
          in: header
          type: string
          description: Default catalog for the query session
        - name: X-Trino-Schema
          in: header
          type: string
          description: Default schema for the query session
        - name: X-Trino-Source
          in: header
          type: string
          description: Identifies the client application submitting the query
        - name: X-Trino-Session
          in: header
          type: string
          description: Comma-separated list of session property assignments in key=value format
        - name: X-Trino-Transaction-Id
          in: header
          type: string
          description: Transaction identifier for query grouping. Use NONE for auto-commit.
        - name: X-Trino-Client-Tags
          in: header
          type: string
          description: Comma-separated client tags for resource group matching
        - name: X-Trino-Client-Info
          in: header
          type: string
          description: Arbitrary client-supplied metadata about the client
        - name: X-Trino-Time-Zone
          in: header
          type: string
          description: Time zone for the query session (IANA tz database format)
        - name: X-Trino-Language
          in: header
          type: string
          description: BCP 47 language tag for locale-sensitive operations
        - name: X-Trino-Trace-Token
          in: header
          type: string
          description: External trace token for distributed tracing correlation
        - name: X-Trino-Extra-Credential
          in: header
          type: string
          description: Connector-specific extra credentials in name=value format. May appear multiple times.
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: v1-statement-queryId-token
      path: /v1/statement/{queryId}/{token}
      operations:
      - name: getqueryresults
        method: GET
        description: Get Query Results
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: queryId
          in: path
          type: string
          description: The unique query identifier returned by POST /v1/statement
          required: true
        - name: token
          in: path
          type: integer
          description: Sequential token for paging through results
          required: true
        - name: X-Trino-User
          in: header
          type: string
          description: The user identity (must match original query submission)
          required: true
        - name: maxWait
          in: query
          type: string
          description: Maximum duration to wait for results before returning empty batch
        - name: targetResultSize
          in: query
          type: string
          description: Desired result batch size hint
      - name: cancelquery
        method: DELETE
        description: Cancel Query
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: queryId
          in: path
          type: string
          description: The unique query identifier
          required: true
        - name: token
          in: path
          type: integer
          description: Sequential token matching the current position
          required: true
        - name: X-Trino-User
          in: header
          type: string
          description: The user identity
          required: true
  exposes:
  - type: rest
    namespace: client-queries-rest
    port: 8080
    description: REST adapter for Trino Client REST API — Queries. One Spectral-compliant resource per consumed operation,
      prefixed with /v1.
    resources:
    - path: /v1/v1/query
      name: v1-query
      description: REST surface for v1-query.
      operations:
      - method: GET
        name: listqueries
        description: List Active Queries
        call: client-queries.listqueries
        with:
          state: rest.state
          limit: rest.limit
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/statement
      name: v1-statement
      description: REST surface for v1-statement.
      operations:
      - method: POST
        name: submitstatement
        description: Submit SQL Statement
        call: client-queries.submitstatement
        with:
          X-Trino-User: rest.X-Trino-User
          X-Trino-Catalog: rest.X-Trino-Catalog
          X-Trino-Schema: rest.X-Trino-Schema
          X-Trino-Source: rest.X-Trino-Source
          X-Trino-Session: rest.X-Trino-Session
          X-Trino-Transaction-Id: rest.X-Trino-Transaction-Id
          X-Trino-Client-Tags: rest.X-Trino-Client-Tags
          X-Trino-Client-Info: rest.X-Trino-Client-Info
          X-Trino-Time-Zone: rest.X-Trino-Time-Zone
          X-Trino-Language: rest.X-Trino-Language
          X-Trino-Trace-Token: rest.X-Trino-Trace-Token
          X-Trino-Extra-Credential: rest.X-Trino-Extra-Credential
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/v1/statement/{queryid}/{token}
      name: v1-statement-queryid-token
      description: REST surface for v1-statement-queryId-token.
      operations:
      - method: GET
        name: getqueryresults
        description: Get Query Results
        call: client-queries.getqueryresults
        with:
          queryId: rest.queryId
          token: rest.token
          X-Trino-User: rest.X-Trino-User
          maxWait: rest.maxWait
          targetResultSize: rest.targetResultSize
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: cancelquery
        description: Cancel Query
        call: client-queries.cancelquery
        with:
          queryId: rest.queryId
          token: rest.token
          X-Trino-User: rest.X-Trino-User
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: client-queries-mcp
    port: 9090
    transport: http
    description: MCP adapter for Trino Client REST API — Queries. One tool per consumed operation, routed inline through this
      capability's consumes block.
    tools:
    - name: list-active-queries
      description: List Active Queries
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: client-queries.listqueries
      with:
        state: tools.state
        limit: tools.limit
      outputParameters:
      - type: object
        mapping: $.
    - name: submit-sql-statement
      description: Submit SQL Statement
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: client-queries.submitstatement
      with:
        X-Trino-User: tools.X-Trino-User
        X-Trino-Catalog: tools.X-Trino-Catalog
        X-Trino-Schema: tools.X-Trino-Schema
        X-Trino-Source: tools.X-Trino-Source
        X-Trino-Session: tools.X-Trino-Session
        X-Trino-Transaction-Id: tools.X-Trino-Transaction-Id
        X-Trino-Client-Tags: tools.X-Trino-Client-Tags
        X-Trino-Client-Info: tools.X-Trino-Client-Info
        X-Trino-Time-Zone: tools.X-Trino-Time-Zone
        X-Trino-Language: tools.X-Trino-Language
        X-Trino-Trace-Token: tools.X-Trino-Trace-Token
        X-Trino-Extra-Credential: tools.X-Trino-Extra-Credential
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: get-query-results
      description: Get Query Results
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: client-queries.getqueryresults
      with:
        queryId: tools.queryId
        token: tools.token
        X-Trino-User: tools.X-Trino-User
        maxWait: tools.maxWait
        targetResultSize: tools.targetResultSize
      outputParameters:
      - type: object
        mapping: $.
    - name: cancel-query
      description: Cancel Query
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: client-queries.cancelquery
      with:
        queryId: tools.queryId
        token: tools.token
        X-Trino-User: tools.X-Trino-User
      outputParameters:
      - type: object
        mapping: $.