Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

4.6 KB
Raw Blame
# MCP tool definitions. Tools are opt-in: an operation is exposed only when it has an entry here.
# List operations without an entry: pnpm --filter=@posthog/mcp run scaffold-yaml -- --candidates --product metrics
# Add one: pnpm --filter=@posthog/mcp run scaffold-yaml -- --add <operationId> --product metrics
# To keep an operation off on purpose, set enabled: false and give a disabled_reason.
category: Metrics
feature: metrics
url_prefix: /metrics
ui_apps: {}
tools:
    characterize-metric-anomaly:
        operation: metrics_characterize_create
        enabled: true
        scopes:
            - metrics:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: Characterize metric anomaly
        description_file: ./prompts/characterize-metric-anomaly.md
        system_prompt_hint: First call when investigating "metric X looks wrong" — magnitude, onset, which labels moved
        search_keywords:
            - prometheus
            - grafana
            - alertmanager
            - alert
            - incident
        feature_flag: metrics
    metric-attribute-values-list:
        operation: metrics_attribute_values_retrieve
        enabled: true
        scopes:
            - metrics:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: List metric attribute values
        description: >
            List the values of one attribute key of a metric, from the most frequent value to the least frequent. Use it
            to find the exact value for a filter, for example the service.name of a service.
        feature_flag: metrics
        response:
            include:
                - results
    metric-attributes-list:
        operation: metrics_attributes_retrieve
        enabled: true
        scopes:
            - metrics:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: List metric attributes
        description: >
            List the attribute keys (labels) of the project's metrics, from the key on the most series to the key on the
            fewest. Pass metricName to list the keys of one metric. Use a key as a filter or a group-by key in
            query-metrics, or as a PromQL label name. In PromQL, service.name is service_name and other names with dots
            need quotes.
        system_prompt_hint: Find the labels of a metric before you filter or group it
        search_keywords:
            - prometheus
            - promql
            - grafana
        feature_flag: metrics
        response:
            include:
                - results
    metric-names-list:
        operation: metrics_values_retrieve
        enabled: true
        scopes:
            - metrics:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: List metric names
        description_file: ./prompts/metric-names-list.md
        system_prompt_hint: Discover which server/infrastructure (Prometheus/OTel) metrics exist before querying them
        search_keywords:
            - prometheus
            - grafana
            - victoriametrics
            - infrastructure
        feature_flag: metrics
        response:
            include:
                - results
    metrics-dashboard-panels-validate:
        operation: metrics_dashboard_imports_validate_create
        enabled: true
        scopes:
            - metrics:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: Validate dashboard panel queries
        description_file: ./prompts/metrics-dashboard-panels-validate.md
        feature_flag: metrics-dashboard-import
    query-metrics:
        operation: metrics_query_create
        enabled: true
        scopes:
            - metrics:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: Query metrics
        description_file: ./prompts/query-metrics.md
        system_prompt_hint:
            Server/infrastructure metrics (OTel/Prometheus) — time series, rates, quantiles, formulas, or a
            PromQL expression from an alert, runbook or Grafana panel
        search_keywords:
            - prometheus
            - promql
            - grafana
            - victoriametrics
            - alertmanager
            - vmalert
            - infrastructure
        feature_flag: metrics
        response:
            include:
                - results
                - hint