Polygon · Capability

Polygon Stocks REST API — Aggregates

Stocks — Aggregates. 1 operation. Lead operation: Get Aggregate Bars For A Stock Ticker. Self-contained Naftiko capability covering one Polygon business surface.

Run with Naftiko PolygonStocksAggregates

What You Can Do

GET
Getstocksaggregatebars — Get aggregate bars for a stock ticker.
/v1/stocks/{stocks-ticker}/aggregates/{multiplier}/{timespan}/{from}/{to}

MCP Tools

get-stocks-aggregate-bars

Get aggregate bars for a stock ticker.

read-only idempotent

Capability Spec

stocks-aggregates.yaml Raw ↑
naftiko: "1.0.0-alpha2"

info:
  label: "Polygon Stocks REST API — Aggregates"
  description: >-
    Stocks — Aggregates. 1 operation. Lead operation: Get Aggregate Bars
    For A Stock Ticker. Self-contained Naftiko capability covering one
    Polygon business surface.
  tags:
    - Polygon
    - Stocks
    - Aggregates
  created: "2026-05-29"
  modified: "2026-05-29"

binds:
  - namespace: env
    keys:
      POLYGON_API_KEY: POLYGON_API_KEY

capability:

  consumes:
    - type: http
      namespace: "stocks-aggregates"
      baseUri: "https://api.polygon.io"
      description: "Polygon Stocks API — Aggregates business capability."
      authentication:
        type: bearer
        token: "{{env.POLYGON_API_KEY}}"
      resources:
        - name: "stocks-aggregate-bars"
          path: "/v2/aggs/ticker/{stocksTicker}/range/{multiplier}/{timespan}/{from}/{to}"
          operations:
            - name: "getStocksAggregateBars"
              method: GET
              description: "Get aggregate bars for a stock ticker over a date range."
              inputParameters:
                - name: stocksTicker
                  in: path
                  type: string
                  required: true
                - name: multiplier
                  in: path
                  type: integer
                  required: true
                - name: timespan
                  in: path
                  type: string
                  required: true
                - name: from
                  in: path
                  type: string
                  required: true
                - name: to
                  in: path
                  type: string
                  required: true
                - name: adjusted
                  in: query
                  type: boolean
                  required: false
                - name: sort
                  in: query
                  type: string
                  required: false
                - name: limit
                  in: query
                  type: integer
                  required: false
              outputRawFormat: json
              outputParameters:
                - name: result
                  type: object
                  value: "$."

  exposes:
    - type: rest
      namespace: "stocks-aggregates-rest"
      port: 8080
      description: "REST adapter for Polygon Stocks — Aggregates."
      resources:
        - path: "/v1/stocks/{stocks-ticker}/aggregates/{multiplier}/{timespan}/{from}/{to}"
          name: "stocks-aggregate-bars"
          description: "REST surface for stocks aggregate bars."
          operations:
            - method: GET
              name: "getStocksAggregateBars"
              description: "Get aggregate bars for a stock ticker."
              call: "stocks-aggregates.getStocksAggregateBars"
              with:
                stocksTicker: "rest.stocksTicker"
                multiplier: "rest.multiplier"
                timespan: "rest.timespan"
                from: "rest.from"
                to: "rest.to"
                adjusted: "rest.adjusted"
                sort: "rest.sort"
                limit: "rest.limit"
              outputParameters:
                - type: object
                  mapping: "$."

    - type: mcp
      namespace: "stocks-aggregates-mcp"
      port: 9090
      transport: http
      description: "MCP adapter for Polygon Stocks — Aggregates."
      tools:
        - name: "get-stocks-aggregate-bars"
          description: "Get aggregate bars for a stock ticker."
          hints:
            readOnly: true
            destructive: false
            idempotent: true
          call: "stocks-aggregates.getStocksAggregateBars"
          with:
            stocksTicker: "tools.stocksTicker"
            multiplier: "tools.multiplier"
            timespan: "tools.timespan"
            from: "tools.from"
            to: "tools.to"
            adjusted: "tools.adjusted"
            sort: "tools.sort"
            limit: "tools.limit"
          outputParameters:
            - type: object
              mapping: "$."