Mixpanel · Capability

Mixpanel Query API — Segmentation

Mixpanel Query API — Segmentation. 3 operations. Lead operation: Mixpanel Query event segmentation. Self-contained Naftiko capability covering one Mixpanel business surface.

Run with Naftiko MixpanelSegmentation

What You Can Do

GET
Querysegmentation — Mixpanel Query event segmentation
/v1/segmentation
GET
Querysegmentationaverage — Mixpanel Query numeric property average
/v1/segmentation/average
GET
Querysegmentationsum — Mixpanel Query numeric property sum
/v1/segmentation/sum

MCP Tools

mixpanel-query-event-segmentation

Mixpanel Query event segmentation

read-only idempotent
mixpanel-query-numeric-property-average

Mixpanel Query numeric property average

read-only idempotent
mixpanel-query-numeric-property-sum

Mixpanel Query numeric property sum

read-only idempotent

Capability Spec

query-segmentation.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Mixpanel Query API — Segmentation
  description: 'Mixpanel Query API — Segmentation. 3 operations. Lead operation: Mixpanel Query event segmentation. Self-contained
    Naftiko capability covering one Mixpanel business surface.'
  tags:
  - Mixpanel
  - Segmentation
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    MIXPANEL_API_KEY: MIXPANEL_API_KEY
capability:
  consumes:
  - type: http
    namespace: query-segmentation
    baseUri: https://mixpanel.com/api/2.0
    description: Mixpanel Query API — Segmentation business capability. Self-contained, no shared references.
    resources:
    - name: segmentation
      path: /segmentation
      operations:
      - name: querysegmentation
        method: GET
        description: Mixpanel Query event segmentation
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: project_id
          in: query
          type: integer
          description: The Mixpanel project ID
          required: true
        - name: event
          in: query
          type: string
          description: The event name to query
          required: true
        - name: from_date
          in: query
          type: string
          description: Start date (YYYY-MM-DD)
          required: true
        - name: to_date
          in: query
          type: string
          description: End date (YYYY-MM-DD)
          required: true
        - name: type
          in: query
          type: string
          description: Aggregation type - general (total count), unique (unique users), or average (average per user)
        - name: 'on'
          in: query
          type: string
          description: Property expression to segment results by
        - name: where
          in: query
          type: string
          description: Expression to filter events
        - name: unit
          in: query
          type: string
          description: Time granularity for the results
        - name: limit
          in: query
          type: integer
          description: Maximum number of segment values
    - name: segmentation-average
      path: /segmentation/average
      operations:
      - name: querysegmentationaverage
        method: GET
        description: Mixpanel Query numeric property average
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: project_id
          in: query
          type: integer
          description: The Mixpanel project ID
          required: true
        - name: event
          in: query
          type: string
          description: The event name to query
          required: true
        - name: from_date
          in: query
          type: string
          description: Start date (YYYY-MM-DD)
          required: true
        - name: to_date
          in: query
          type: string
          description: End date (YYYY-MM-DD)
          required: true
        - name: 'on'
          in: query
          type: string
          description: The numeric property to average
          required: true
        - name: unit
          in: query
          type: string
          description: Time granularity for the results
    - name: segmentation-sum
      path: /segmentation/sum
      operations:
      - name: querysegmentationsum
        method: GET
        description: Mixpanel Query numeric property sum
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: project_id
          in: query
          type: integer
          description: The Mixpanel project ID
          required: true
        - name: event
          in: query
          type: string
          description: The event name to query
          required: true
        - name: from_date
          in: query
          type: string
          description: Start date (YYYY-MM-DD)
          required: true
        - name: to_date
          in: query
          type: string
          description: End date (YYYY-MM-DD)
          required: true
        - name: 'on'
          in: query
          type: string
          description: The numeric property to sum
          required: true
        - name: where
          in: query
          type: string
          description: Expression to filter events
        - name: unit
          in: query
          type: string
          description: Time granularity for the results
    authentication:
      type: basic
      username: '{{env.MIXPANEL_USER}}'
      password: '{{env.MIXPANEL_PASS}}'
  exposes:
  - type: rest
    namespace: query-segmentation-rest
    port: 8080
    description: REST adapter for Mixpanel Query API — Segmentation. One Spectral-compliant resource per consumed operation,
      prefixed with /v1.
    resources:
    - path: /v1/segmentation
      name: segmentation
      description: REST surface for segmentation.
      operations:
      - method: GET
        name: querysegmentation
        description: Mixpanel Query event segmentation
        call: query-segmentation.querysegmentation
        with:
          project_id: rest.project_id
          event: rest.event
          from_date: rest.from_date
          to_date: rest.to_date
          type: rest.type
          'on': rest.on
          where: rest.where
          unit: rest.unit
          limit: rest.limit
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/segmentation/average
      name: segmentation-average
      description: REST surface for segmentation-average.
      operations:
      - method: GET
        name: querysegmentationaverage
        description: Mixpanel Query numeric property average
        call: query-segmentation.querysegmentationaverage
        with:
          project_id: rest.project_id
          event: rest.event
          from_date: rest.from_date
          to_date: rest.to_date
          'on': rest.on
          unit: rest.unit
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/segmentation/sum
      name: segmentation-sum
      description: REST surface for segmentation-sum.
      operations:
      - method: GET
        name: querysegmentationsum
        description: Mixpanel Query numeric property sum
        call: query-segmentation.querysegmentationsum
        with:
          project_id: rest.project_id
          event: rest.event
          from_date: rest.from_date
          to_date: rest.to_date
          'on': rest.on
          where: rest.where
          unit: rest.unit
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: query-segmentation-mcp
    port: 9090
    transport: http
    description: MCP adapter for Mixpanel Query API — Segmentation. One tool per consumed operation, routed inline through
      this capability's consumes block.
    tools:
    - name: mixpanel-query-event-segmentation
      description: Mixpanel Query event segmentation
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: query-segmentation.querysegmentation
      with:
        project_id: tools.project_id
        event: tools.event
        from_date: tools.from_date
        to_date: tools.to_date
        type: tools.type
        'on': tools.on
        where: tools.where
        unit: tools.unit
        limit: tools.limit
      outputParameters:
      - type: object
        mapping: $.
    - name: mixpanel-query-numeric-property-average
      description: Mixpanel Query numeric property average
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: query-segmentation.querysegmentationaverage
      with:
        project_id: tools.project_id
        event: tools.event
        from_date: tools.from_date
        to_date: tools.to_date
        'on': tools.on
        unit: tools.unit
      outputParameters:
      - type: object
        mapping: $.
    - name: mixpanel-query-numeric-property-sum
      description: Mixpanel Query numeric property sum
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: query-segmentation.querysegmentationsum
      with:
        project_id: tools.project_id
        event: tools.event
        from_date: tools.from_date
        to_date: tools.to_date
        'on': tools.on
        where: tools.where
        unit: tools.unit
      outputParameters:
      - type: object
        mapping: $.