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.

9.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 replay
# Add one: pnpm --filter=@posthog/mcp run scaffold-yaml -- --add <operationId> --product replay
# To keep an operation off on purpose, set enabled: false and give a disabled_reason.
category: Session replays
feature: replay
url_prefix: /replay
ui_apps:
    session-recording:
        type: detail
        view_prop: recording
tools:
    session-recording-bulk-delete:
        operation: session_recordings_bulk_delete_create
        enabled: true
        scopes:
            - session_recording:write
        annotations:
            readOnly: false
            destructive: true
            idempotent: true
        title: Bulk delete session recordings
        description: >
            Delete a batch of session recordings by session ID, up to 100 per call. Deletion is permanent and cannot be
            undone — confirm with the user before deleting. Prefer this over `session-recording-delete` whenever more
            than one recording needs deleting: find the target IDs with `query-session-recordings-list`, then delete in
            batches. Pass `date_from` (e.g. '-30d') when the recordings' age is known — it makes the lookup much faster.
            IDs with no matching recording are skipped, so a `deleted_count` below `total_requested` is normal when some
            recordings were already deleted or never existed.
    session-recording-console-logs-list:
        operation: session_recordings_console_logs_retrieve
        enabled: true
        scopes:
            - session_recording:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: List session recording console logs
        description: >
            List the browser console messages captured during a session recording, oldest first. Use this after
            `session-recording-get` reports console log, warning, or error counts and you need the actual text, for
            example to tell a JavaScript exception apart from a failed network or resource load. Filter with `level`
            (`info`, `warn`, or `error`), narrow the time range with `after` and `before`, and page with `limit` and
            `offset` while `has_more` is true. Results never extend outside the recording's own start and end time.
            Identical messages logged close together can be collapsed into one entry, so the number of entries can be
            lower than the counts on the recording. Entries carry only the message text: there are no stack traces here.
            For an exception's stack trace, look up `$exception` events with the same `$session_id` through the error
            tracking tools. An empty `results` list does not always mean the session logged nothing: check
            `console_log_capture_enabled` (false means the project does not capture console logs) and `logs_expired`
            (true means the recording is older than the console log retention period).
        feature_flag: mcp-session-recording-console-logs
    session-recording-delete:
        operation: session_recordings_destroy
        enabled: true
        scopes:
            - session_recording:write
        annotations:
            readOnly: false
            destructive: true
            idempotent: true
        title: Delete session recording
        description: >
            Delete a session recording by ID. This permanently removes the recording data. Use for privacy or compliance
            workflows. To delete more than one recording, use `session-recording-bulk-delete` instead of calling this
            repeatedly.
    session-recording-get:
        operation: session_recordings_retrieve
        enabled: true
        scopes:
            - session_recording:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        enrich_url: '{id}'
        title: Get session recording
        description: >
            Get a specific session recording by ID. Returns full recording metadata including duration, interaction
            counts, console log counts, viewing status, and a compact person summary (id, name, distinct IDs). The
            person's full property bag is not included — use `persons-retrieve` when you need a person's properties.
            Session recordings are reachable from events, errors, and persons via the `$session_id` property on events.
            Any `$session_id` value from an event can be passed as the `id` parameter to this tool. Note: a
            `$session_id` on an event does not guarantee a recording exists — session replay may not be enabled for that
            project or session. When no recording is available, the tool returns `found: false` with reason
            `recording_not_found`; this is a normal lookup result, not a tool failure. If the user wants to understand
            what happened without watching the recording, check `vision-observations-list` for an existing Replay Vision
            AI summary of the session. To generate one, call `vision-scanners-inline-scan` with the session id in
            `session_ids`, `scanner_type: "summarizer"`, and a `prompt` (required), then read the summary back with
            `vision-observations-list`. The investigating-replay skill carries the exact prompt and `scanner_config` the
            Summarize button in the player uses, so pass those to land on the same summary (scanning is slow).
            `vision-scanners-scan-session` points a saved scanner at the session instead. If a recording is missing
            (`found: false`) or the user asks why recordings aren't being captured, diagnose with `execute-sql`: query
            `$recording_status`, `$session_recording_start_reason`, `$replay_sample_rate`, and
            `$sdk_debug_recording_script_not_loaded` from the events table (filter by `$session_id` for a specific
            session, or sample recent events for project-wide issues).
        ui_app: session-recording
        hooks: replay/sessionRecordingGetHooks
        response:
            exclude:
                - person.properties
    session-recording-playlist-create:
        operation: session_recording_playlists_create
        enabled: true
        scopes:
            - session_recording_playlist:write
        annotations:
            readOnly: false
            destructive: false
            idempotent: false
        title: Create session recording playlist
        description: >
            Create a new session recording playlist. Set type to 'collection' for a manually curated list or 'filters'
            for a saved filter view. Collections cannot have filters, and filter playlists must include at least one
            filter criterion.
        exclude_params:
            - created_at
            - created_by
            - last_modified_at
            - last_modified_by
            - recordings_counts
            - is_synthetic
            - _create_in_folder
            - creation_method
    session-recording-playlist-get:
        operation: session_recording_playlists_retrieve
        enabled: true
        scopes:
            - session_recording_playlist:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: Get session recording playlist
        description: >
            Get a specific session recording playlist by short_id. Returns full playlist metadata including name,
            description, filters, type, and recording counts.
    session-recording-playlist-update:
        operation: session_recording_playlists_partial_update
        enabled: true
        scopes:
            - session_recording_playlist:write
        annotations:
            readOnly: false
            destructive: false
            idempotent: true
        title: Update session recording playlist
        description: >
            Update an existing session recording playlist by short_id. Can update name, description, pinned status, and
            filters. Set deleted to true to soft-delete. The type field cannot be changed after creation. When updating
            a filters-type playlist, you must include the existing filters alongside other field changes, otherwise the
            update will fail.
        exclude_params:
            - created_at
            - created_by
            - last_modified_at
            - last_modified_by
            - recordings_counts
            - is_synthetic
            - _create_in_folder
            - creation_method
            - type
    session-recording-playlists-list:
        operation: session_recording_playlists_list
        enabled: true
        scopes:
            - session_recording_playlist:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        list: true
        title: List session recording playlists
        description: >
            List session recording playlists in the project. Returns both user-created and synthetic (system-generated)
            playlists with their metadata and recording counts.
wrappers:
    query-session-recordings-list:
        schema_ref: AssistantRecordingsQuery
        enabled: true
        scopes:
            - session_recording:read
        annotations:
            readOnly: true
            destructive: false
            idempotent: true
        title: List session recordings
        description_file: ./prompts/query-session-recordings-list.md
        system_prompt_hint: Session replay metadata and activity
        exclude_properties:
            - response
            - modifiers
        url_prefix: /replay