Dynatrace · Capability

Dynatrace Metrics API v2 — Metrics

Dynatrace Metrics API v2 — Metrics. 5 operations. Lead operation: Dynatrace List All Metrics. Self-contained Naftiko capability covering one Dynatrace business surface.

Run with Naftiko DynatraceMetrics

What You Can Do

GET
Listmetrics — Dynatrace List All Metrics
/v1/metrics
POST
Ingestcustommetrics — Dynatrace Ingest Custom Metrics
/v1/metrics/ingest
GET
Querymetricdata — Dynatrace Query Metric Data Points
/v1/metrics/query
GET
Getmetricdescriptor — Dynatrace Get Metric Descriptor
/v1/metrics/{metrickey}
DELETE
Deletecustommetric — Dynatrace Delete Custom Metric
/v1/metrics/{metrickey}

MCP Tools

dynatrace-list-all-metrics

Dynatrace List All Metrics

read-only idempotent
dynatrace-ingest-custom-metrics

Dynatrace Ingest Custom Metrics

dynatrace-query-metric-data-points

Dynatrace Query Metric Data Points

read-only idempotent
dynatrace-get-metric-descriptor

Dynatrace Get Metric Descriptor

read-only idempotent
dynatrace-delete-custom-metric

Dynatrace Delete Custom Metric

idempotent

Capability Spec

metrics-api-v2-metrics.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Dynatrace Metrics API v2 — Metrics
  description: 'Dynatrace Metrics API v2 — Metrics. 5 operations. Lead operation: Dynatrace List All Metrics. Self-contained
    Naftiko capability covering one Dynatrace business surface.'
  tags:
  - Dynatrace
  - Metrics
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    DYNATRACE_API_KEY: DYNATRACE_API_KEY
capability:
  consumes:
  - type: http
    namespace: metrics-api-v2-metrics
    baseUri: https://{environmentId}.live.dynatrace.com/api/v2
    description: Dynatrace Metrics API v2 — Metrics business capability. Self-contained, no shared references.
    resources:
    - name: metrics
      path: /metrics
      operations:
      - name: listmetrics
        method: GET
        description: Dynatrace List All Metrics
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: nextPageKey
          in: query
          type: string
          description: 'The cursor for the next page of results. Obtained from the nextPageKey field of a previous response.
            When this parameter is set, all other query parameters are '
        - name: pageSize
          in: query
          type: integer
          description: The number of metric descriptors to return per page. Default is 50, maximum is 500.
        - name: metricSelector
          in: query
          type: string
          description: Selects metrics for the response. Use the metric selector syntax to filter metrics by key, entity type,
            or other properties. For example, builtin:host.cpu.usage
        - name: fields
          in: query
          type: string
          description: Defines the list of metric properties included in the response. Use a comma-separated list of property
            names. To add a property, prefix it with a plus (+) sign,
        - name: writtenSince
          in: query
          type: string
          description: 'Filters the resulted set of metrics to those that have been written after the specified time. Use
            the timeframe format: now-1h, now-1d, or an absolute timestamp'
        - name: metricDescriptors
          in: query
          type: boolean
          description: Whether to include metric descriptor details in the response.
    - name: metrics-ingest
      path: /metrics/ingest
      operations:
      - name: ingestcustommetrics
        method: POST
        description: Dynatrace Ingest Custom Metrics
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: metrics-query
      path: /metrics/query
      operations:
      - name: querymetricdata
        method: GET
        description: Dynatrace Query Metric Data Points
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: metricSelector
          in: query
          type: string
          description: Selects metrics for the query. Required. Supports transformations such as :avg, :max, :sum, :splitBy,
            :filter. For example, builtin:host.cpu.usage:avg:auto.
          required: true
        - name: resolution
          in: query
          type: string
          description: The desired time resolution of the data points. Valid units are m (minutes), h (hours), d (days). For
            example, 5m, 1h. Use Inf for a single data point aggregate
        - name: from
          in: query
          type: string
          description: 'The start of the queried time range. Use one of: relative expression (now-1h), ISO 8601 timestamp,
            or Unix timestamp in milliseconds. Default is now-2h.'
        - name: to
          in: query
          type: string
          description: 'The end of the queried time range. Use one of: relative expression (now), ISO 8601 timestamp, or Unix
            timestamp in milliseconds. Default is now.'
        - name: entitySelector
          in: query
          type: string
          description: Filters results to entities matching the selector. Use the entity selector syntax, e.g., type(HOST),tag(production).
            Only metrics with an entity dimension can b
        - name: mzSelector
          in: query
          type: string
          description: Filters results to entities belonging to the specified management zone. Use the management zone selector
            syntax, e.g., mzName(MyZone).
        - name: selectorInputMetrics
          in: query
          type: boolean
          description: When set to true, the response includes the input metrics used by the selector before transformations
            are applied.
    - name: metrics-metricKey
      path: /metrics/{metricKey}
      operations:
      - name: getmetricdescriptor
        method: GET
        description: Dynatrace Get Metric Descriptor
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: deletecustommetric
        method: DELETE
        description: Dynatrace Delete Custom Metric
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
    authentication:
      type: apikey
      key: Authorization
      value: '{{env.DYNATRACE_API_KEY}}'
      placement: header
  exposes:
  - type: rest
    namespace: metrics-api-v2-metrics-rest
    port: 8080
    description: REST adapter for Dynatrace Metrics API v2 — Metrics. One Spectral-compliant resource per consumed operation,
      prefixed with /v1.
    resources:
    - path: /v1/metrics
      name: metrics
      description: REST surface for metrics.
      operations:
      - method: GET
        name: listmetrics
        description: Dynatrace List All Metrics
        call: metrics-api-v2-metrics.listmetrics
        with:
          nextPageKey: rest.nextPageKey
          pageSize: rest.pageSize
          metricSelector: rest.metricSelector
          fields: rest.fields
          writtenSince: rest.writtenSince
          metricDescriptors: rest.metricDescriptors
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/metrics/ingest
      name: metrics-ingest
      description: REST surface for metrics-ingest.
      operations:
      - method: POST
        name: ingestcustommetrics
        description: Dynatrace Ingest Custom Metrics
        call: metrics-api-v2-metrics.ingestcustommetrics
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/metrics/query
      name: metrics-query
      description: REST surface for metrics-query.
      operations:
      - method: GET
        name: querymetricdata
        description: Dynatrace Query Metric Data Points
        call: metrics-api-v2-metrics.querymetricdata
        with:
          metricSelector: rest.metricSelector
          resolution: rest.resolution
          from: rest.from
          to: rest.to
          entitySelector: rest.entitySelector
          mzSelector: rest.mzSelector
          selectorInputMetrics: rest.selectorInputMetrics
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/metrics/{metrickey}
      name: metrics-metrickey
      description: REST surface for metrics-metricKey.
      operations:
      - method: GET
        name: getmetricdescriptor
        description: Dynatrace Get Metric Descriptor
        call: metrics-api-v2-metrics.getmetricdescriptor
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: deletecustommetric
        description: Dynatrace Delete Custom Metric
        call: metrics-api-v2-metrics.deletecustommetric
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: metrics-api-v2-metrics-mcp
    port: 9090
    transport: http
    description: MCP adapter for Dynatrace Metrics API v2 — Metrics. One tool per consumed operation, routed inline through
      this capability's consumes block.
    tools:
    - name: dynatrace-list-all-metrics
      description: Dynatrace List All Metrics
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: metrics-api-v2-metrics.listmetrics
      with:
        nextPageKey: tools.nextPageKey
        pageSize: tools.pageSize
        metricSelector: tools.metricSelector
        fields: tools.fields
        writtenSince: tools.writtenSince
        metricDescriptors: tools.metricDescriptors
      outputParameters:
      - type: object
        mapping: $.
    - name: dynatrace-ingest-custom-metrics
      description: Dynatrace Ingest Custom Metrics
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: metrics-api-v2-metrics.ingestcustommetrics
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: dynatrace-query-metric-data-points
      description: Dynatrace Query Metric Data Points
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: metrics-api-v2-metrics.querymetricdata
      with:
        metricSelector: tools.metricSelector
        resolution: tools.resolution
        from: tools.from
        to: tools.to
        entitySelector: tools.entitySelector
        mzSelector: tools.mzSelector
        selectorInputMetrics: tools.selectorInputMetrics
      outputParameters:
      - type: object
        mapping: $.
    - name: dynatrace-get-metric-descriptor
      description: Dynatrace Get Metric Descriptor
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: metrics-api-v2-metrics.getmetricdescriptor
      outputParameters:
      - type: object
        mapping: $.
    - name: dynatrace-delete-custom-metric
      description: Dynatrace Delete Custom Metric
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: metrics-api-v2-metrics.deletecustommetric
      outputParameters:
      - type: object
        mapping: $.