Prisma · Capability

Prisma Client API — Aggregation

Prisma Client API — Aggregation. 3 operations. Lead operation: Prisma Aggregate records. Self-contained Naftiko capability covering one Prisma business surface.

Run with Naftiko PrismaAggregation

What You Can Do

GET
Aggregate — Prisma Aggregate records
/v1/{model}/aggregate
GET
Count — Prisma Count matching records
/v1/{model}/count
GET
Groupby — Prisma Group records and aggregate
/v1/{model}/groupby

MCP Tools

prisma-aggregate-records

Prisma Aggregate records

read-only idempotent
prisma-count-matching-records

Prisma Count matching records

read-only idempotent
prisma-group-records-and-aggregate

Prisma Group records and aggregate

read-only idempotent

Capability Spec

client-aggregation.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Prisma Client API — Aggregation
  description: 'Prisma Client API — Aggregation. 3 operations. Lead operation: Prisma Aggregate records. Self-contained Naftiko
    capability covering one Prisma business surface.'
  tags:
  - Prisma
  - Aggregation
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    PRISMA_API_KEY: PRISMA_API_KEY
capability:
  consumes:
  - type: http
    namespace: client-aggregation
    baseUri: https://localhost:3000/api
    description: Prisma Client API — Aggregation business capability. Self-contained, no shared references.
    resources:
    - name: model-aggregate
      path: /{model}/aggregate
      operations:
      - name: aggregate
        method: GET
        description: Prisma Aggregate records
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: where
          in: query
          type: string
          description: JSON-encoded filter conditions
        - name: _count
          in: query
          type: string
          description: Fields to count or true for total count
        - name: _avg
          in: query
          type: string
          description: JSON-encoded specification of fields to average
        - name: _sum
          in: query
          type: string
          description: JSON-encoded specification of fields to sum
        - name: _min
          in: query
          type: string
          description: JSON-encoded specification of fields to find minimum
        - name: _max
          in: query
          type: string
          description: JSON-encoded specification of fields to find maximum
    - name: model-count
      path: /{model}/count
      operations:
      - name: count
        method: GET
        description: Prisma Count matching records
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: where
          in: query
          type: string
          description: JSON-encoded filter conditions
        - name: select
          in: query
          type: string
          description: JSON-encoded field selection for field-level counts
    - name: model-groupBy
      path: /{model}/groupBy
      operations:
      - name: groupby
        method: GET
        description: Prisma Group records and aggregate
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: by
          in: query
          type: string
          description: JSON-encoded list of fields to group by
          required: true
        - name: where
          in: query
          type: string
          description: JSON-encoded filter conditions applied before grouping
        - name: having
          in: query
          type: string
          description: JSON-encoded filter conditions applied after grouping
        - name: orderBy
          in: query
          type: string
          description: JSON-encoded sort specification for groups
  exposes:
  - type: rest
    namespace: client-aggregation-rest
    port: 8080
    description: REST adapter for Prisma Client API — Aggregation. One Spectral-compliant resource per consumed operation,
      prefixed with /v1.
    resources:
    - path: /v1/{model}/aggregate
      name: model-aggregate
      description: REST surface for model-aggregate.
      operations:
      - method: GET
        name: aggregate
        description: Prisma Aggregate records
        call: client-aggregation.aggregate
        with:
          where: rest.where
          _count: rest._count
          _avg: rest._avg
          _sum: rest._sum
          _min: rest._min
          _max: rest._max
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/{model}/count
      name: model-count
      description: REST surface for model-count.
      operations:
      - method: GET
        name: count
        description: Prisma Count matching records
        call: client-aggregation.count
        with:
          where: rest.where
          select: rest.select
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/{model}/groupby
      name: model-groupby
      description: REST surface for model-groupBy.
      operations:
      - method: GET
        name: groupby
        description: Prisma Group records and aggregate
        call: client-aggregation.groupby
        with:
          by: rest.by
          where: rest.where
          having: rest.having
          orderBy: rest.orderBy
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: client-aggregation-mcp
    port: 9090
    transport: http
    description: MCP adapter for Prisma Client API — Aggregation. One tool per consumed operation, routed inline through this
      capability's consumes block.
    tools:
    - name: prisma-aggregate-records
      description: Prisma Aggregate records
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: client-aggregation.aggregate
      with:
        where: tools.where
        _count: tools._count
        _avg: tools._avg
        _sum: tools._sum
        _min: tools._min
        _max: tools._max
      outputParameters:
      - type: object
        mapping: $.
    - name: prisma-count-matching-records
      description: Prisma Count matching records
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: client-aggregation.count
      with:
        where: tools.where
        select: tools.select
      outputParameters:
      - type: object
        mapping: $.
    - name: prisma-group-records-and-aggregate
      description: Prisma Group records and aggregate
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: client-aggregation.groupby
      with:
        by: tools.by
        where: tools.where
        having: tools.having
        orderBy: tools.orderBy
      outputParameters:
      - type: object
        mapping: $.