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.

7.7 KB
Raw Blame
# MCP query wrapper tool definitions.
#
# Each wrapper generates a typed tool that accepts a single query schema
# from frontend/src/queries/schema.json and POSTs to /api/environments/{project_id}/query/.
#
# schema_ref must match a definition name in schema.json exactly.
# The Zod input schema is auto-generated from the JSON Schema at build time.
category: Query wrappers
feature: insights
wrappers:
    query-trends:
        schema_ref: AssistantTrendsQuery
        enabled: true
        scopes:
            - query:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: Run a trends query
        description_file: ./prompts/query-trends.md
        system_prompt_hint: Time series, aggregations, formulas, comparisons
        ui_resource_uri: ui://posthog/query-results.html
        use_optimized_output: true
        exclude_properties:
            - response
            - modifiers
            - samplingFactor

    query-funnel:
        schema_ref: AssistantFunnelsQuery
        enabled: true
        scopes:
            - query:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: Run a funnel query
        description_file: ./prompts/query-funnel.md
        system_prompt_hint: Conversion rates, drop-off analysis, time to convert
        ui_resource_uri: ui://posthog/query-results.html
        use_optimized_output: true
        exclude_properties:
            - response
            - modifiers
            - samplingFactor

    query-retention:
        schema_ref: AssistantRetentionQuery
        enabled: true
        scopes:
            - query:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: Run a retention query
        description_file: ./prompts/query-retention.md
        system_prompt_hint: User return patterns over time
        ui_resource_uri: ui://posthog/query-results.html
        use_optimized_output: true
        exclude_properties:
            - response
            - modifiers
            - samplingFactor

    query-stickiness:
        schema_ref: AssistantStickinessQuery
        enabled: true
        scopes:
            - query:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: Run a stickiness query
        description_file: ./prompts/query-stickiness.md
        system_prompt_hint: Engagement frequency (how many days users do X)
        ui_resource_uri: ui://posthog/query-results.html
        use_optimized_output: true
        exclude_properties:
            - response
            - modifiers
            - samplingFactor

    query-paths:
        schema_ref: AssistantPathsQuery
        enabled: true
        scopes:
            - query:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: Run a paths query
        description_file: ./prompts/query-paths.md
        system_prompt_hint: User navigation flows and sequences
        ui_resource_uri: ui://posthog/query-results.html
        use_optimized_output: true
        exclude_properties:
            - response
            - modifiers
            - samplingFactor

    query-lifecycle:
        schema_ref: AssistantLifecycleQuery
        enabled: true
        scopes:
            - query:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: Run a lifecycle query
        description_file: ./prompts/query-lifecycle.md
        system_prompt_hint: New, returning, resurrecting, dormant user composition
        ui_resource_uri: ui://posthog/query-results.html
        use_optimized_output: true
        exclude_properties:
            - response
            - modifiers
            - samplingFactor

    query-trends-actors:
        schema_ref: AssistantTrendsActorsQuery
        enabled: true
        scopes:
            - query:read
            - person:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: List persons behind a trends data point
        description_file: ./prompts/query-trends-actors.md
        system_prompt_hint: List persons behind a trends data point
        ui_resource_uri: ui://posthog/insight-actors.html
        use_optimized_output: true
        exclude_properties:
            - response
            - modifiers

    query-lifecycle-actors:
        schema_ref: AssistantLifecycleActorsQuery
        enabled: true
        scopes:
            - query:read
            - person:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: List persons in a lifecycle bucket
        description_file: ./prompts/query-lifecycle-actors.md
        system_prompt_hint: List persons in a lifecycle bucket (new/returning/resurrecting/dormant) for a given day
        ui_resource_uri: ui://posthog/insight-actors.html
        use_optimized_output: true
        exclude_properties:
            - response
            - modifiers

    query-paths-actors:
        schema_ref: AssistantPathsActorsQuery
        enabled: true
        scopes:
            - query:read
            - person:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: List persons on a paths insight
        description_file: ./prompts/query-paths-actors.md
        system_prompt_hint: List persons who traversed the paths defined by a paths insight
        ui_resource_uri: ui://posthog/insight-actors.html
        use_optimized_output: true
        exclude_properties:
            - response
            - modifiers

    query-retention-actors:
        schema_ref: AssistantRetentionActorsQuery
        enabled: true
        scopes:
            - query:read
            - person:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: List persons in a retention cohort
        description_file: ./prompts/query-retention-actors.md
        system_prompt_hint: List persons in a retention acquisition cohort and which intervals they returned in
        ui_resource_uri: ui://posthog/insight-actors.html
        use_optimized_output: true
        exclude_properties:
            - response
            - modifiers

    query-stickiness-actors:
        schema_ref: AssistantStickinessActorsQuery
        enabled: true
        scopes:
            - query:read
            - person:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: List persons behind a stickiness bar
        description_file: ./prompts/query-stickiness-actors.md
        system_prompt_hint: List persons who were active in a given number of intervals (one stickiness bar)
        ui_resource_uri: ui://posthog/insight-actors.html
        use_optimized_output: true
        exclude_properties:
            - response
            - modifiers

    query-funnel-actors:
        schema_ref: AssistantFunnelsActorsQuery
        enabled: true
        scopes:
            - query:read
            - person:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: List persons who converted or dropped off at a funnel step
        description_file: ./prompts/query-funnel-actors.md
        system_prompt_hint: List persons who converted through or dropped off at a given funnel step
        ui_resource_uri: ui://posthog/insight-actors.html
        use_optimized_output: true
        exclude_properties:
            - response
            - modifiers