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.

feat(replay-vision): expose quota, estimate, observation MCP tools (#61220)

Kim Svatos Duganc5bfce93422c
diff --git a/products/replay_vision/mcp/tools.yaml b/products/replay_vision/mcp/tools.yaml
index 2e3dc316ba66..71c411949bc5 100644
--- a/products/replay_vision/mcp/tools.yaml
+++ b/products/replay_vision/mcp/tools.yaml
@@ -11,13 +11,59 @@ ui_apps: {}
tools:
vision-observations-list:
operation: vision_observations_list
- enabled: false
+ enabled: true
+ scopes:
+ - replay_scanner:read
+ - session_recording:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ list: true
+ title: List a session's replay vision observations
+ description: >
+ List every replay vision observation recorded for a single session, across all scanners the caller can read.
+ This is the "what has Replay Vision found about this session?" lookup — pair it with the session-recording
+ MCP tools or the investigating-replay skill while investigating a recording. The `session_id` query
+ parameter is REQUIRED; without it the request is rejected. Each result includes the scanner that produced
+ it, the observation `status` (pending/running/succeeded/failed/ineligible), the `error_reason` for terminal
+ non-success statuses, and the `scanner_result` (LLM output) on success. To list observations for one
+ specific scanner over time instead, use `vision-scanners-observations-list`.
+ feature_flag: replay-vision
vision-observations-retrieve:
operation: vision_observations_retrieve
- enabled: false
+ enabled: true
+ scopes:
+ - replay_scanner:read
+ - session_recording:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ title: Get a session's replay vision observation
+ description: >
+ Get a single replay vision observation by ID, scoped to the scanners the caller can read. Returns the full
+ `scanner_snapshot` (the scanner's configuration at run time) and `scanner_result` (the LLM output, with any
+ event citations). Use `vision-observations-list` to find observation IDs for a session first.
+ feature_flag: replay-vision
vision-quota-retrieve:
operation: environment_vision_quota_retrieve
- enabled: false
+ enabled: true
+ scopes:
+ - replay_scanner:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ title: Get replay vision quota
+ description: >
+ Get the organization's monthly Replay Vision observation budget. Returns `monthly_quota`, `usage_this_month`
+ (in-flight + succeeded observations counted against it), `remaining`, `exhausted`, and the
+ `period_start`/`period_end` of the current calendar-month window. Check `remaining`/`exhausted` before
+ creating a scanner or calling `vision-scanners-scan-session` — observations requested over quota are
+ silently skipped until the next period. Pair with `vision-scanners-estimate-create` to size a new scanner
+ against the remaining budget.
+ feature_flag: replay-vision
vision-scanners-create:
operation: vision_scanners_create
enabled: true
@@ -37,7 +83,11 @@ tools:
`emits_embeddings`. `query` is a `RecordingsQuery` shape that defines which sessions the scanner watches —
`date_from` and `date_to` are ignored (the schedule controls time). `sampling_rate` is a 0..1 random
downsample applied after the query matches (default 1.0). `model` chooses the LLM. Names must be unique
- within the team.
+ within the team. Before creating a broad scanner (a permissive `query` and/or high `sampling_rate`), first
+ call `vision-scanners-estimate-create` to project its monthly observation volume and `vision-quota-retrieve`
+ to check the org's remaining budget — an enabled scanner sweeps matching recordings every 5 minutes, and
+ creation itself does not check quota, so a too-broad scanner can exhaust the monthly budget on its first
+ sweeps.
exclude_params:
- id
- scanner_version
@@ -65,7 +115,23 @@ tools:
feature_flag: replay-vision
vision-scanners-estimate-create:
operation: vision_scanners_estimate_create
- enabled: false
+ enabled: true
+ scopes:
+ - replay_scanner:read
+ - session_recording:read
+ annotations:
+ readOnly: true
+ destructive: false
+ idempotent: true
+ title: Estimate replay vision scanner volume
+ description: >
+ Preview how many observations a proposed scanner would generate before saving it. Send a `query`
+ (`RecordingsQuery` shape; `date_from`/`date_to` are ignored — the estimate uses a fixed 30-day lookback) and
+ an optional `sampling_rate`. Returns `matched_sessions_in_window`, the `window_days` it was measured over,
+ and `estimated_observations_per_month`. Enabled scanners sweep every 5 minutes, so a broad query can exhaust
+ the monthly quota quickly — run this and compare against `vision-quota-retrieve` before
+ `vision-scanners-create`.
+ feature_flag: replay-vision
vision-scanners-get:
operation: vision_scanners_retrieve
enabled: true
@@ -132,9 +198,12 @@ tools:
title: List scanner observations
description: >
List the observations recorded by a single scanner. Each observation is one scan of one session and includes
- its `status` (pending/running/succeeded/failed), `triggered_by` (`schedule` or `on_demand`), `workflow_id`,
- the `scanner_result` (the LLM output validated against the scanner's response schema for that scanner_type),
- and the `session_id` of the recording it analysed. Use this to inspect what a scanner has found over time.
+ its `status` (pending/running/succeeded/failed/ineligible), `error_reason` (set on terminal non-success
+ statuses, e.g. `too_short`/`no_recording` for ineligible or `provider_rejected`/`validation_failed` for
+ failed — useful for triaging why a scan produced no result), `triggered_by` (`schedule` or `on_demand`),
+ `workflow_id`, the `scanner_result` (the LLM output validated against the scanner's response schema for that
+ scanner_type), and the `session_id` of the recording it analysed. Use this to inspect what a scanner has
+ found over time; to see every scanner's observations for one session, use `vision-observations-list`.
feature_flag: replay-vision
vision-scanners-partial-update:
operation: vision_scanners_partial_update
@@ -156,7 +225,8 @@ tools:
`vision-scanners-observations-list` once the Temporal workflow finishes (typically several minutes —
rasterising the recording into video and calling the LLM is slow). Useful for ad-hoc scanning during an
investigation: pick a scanner that matches the question you want answered, and point it at the session
- you're examining.
+ you're examining. A scanner can observe a given session only once — re-triggering it on a session that
+ already has an observation (even a failed or ineligible one) is a no-op and will not produce a fresh scan.
requires_ai_consent: true
feature_flag: replay-vision
vision-scanners-update:
@@ -175,7 +245,9 @@ tools:
toggle `enabled` to pause/resume scanning, adjust `sampling_rate`, tweak the `scanner_config` prompt or
tags, or refine the `query` to watch a different slice of sessions. `scanner_type` is locked after creation
— to change it, delete and recreate. Editing any config field bumps `scanner_version`; existing observations
- keep a snapshot of the previous config for reproducibility.
+ keep a snapshot of the previous config for reproducibility. If you widen the `query` or raise
+ `sampling_rate`, re-check projected volume with `vision-scanners-estimate-create` and remaining budget with
+ `vision-quota-retrieve` first — the scanner resumes sweeping every 5 minutes at the new, broader scope.
exclude_params:
- id
- scanner_version
diff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.json
index bb61490c1d01..ed6628954725 100644
--- a/services/mcp/schema/generated-tool-definitions.json
+++ b/services/mcp/schema/generated-tool-definitions.json
@@ -5429,8 +5429,53 @@
"readOnlyHint": false
}
},
+ "vision-observations-list": {
+ "description": "List every replay vision observation recorded for a single session, across all scanners the caller can read. This is the \"what has Replay Vision found about this session?\" lookup — pair it with the session-recording MCP tools or the investigating-replay skill while investigating a recording. The `session_id` query parameter is REQUIRED; without it the request is rejected. Each result includes the scanner that produced it, the observation `status` (pending/running/succeeded/failed/ineligible), the `error_reason` for terminal non-success statuses, and the `scanner_result` (LLM output) on success. To list observations for one specific scanner over time instead, use `vision-scanners-observations-list`.",
+ "category": "Replay vision",
+ "feature": "replay_vision",
+ "summary": "List a session's replay vision observations",
+ "title": "List a session's replay vision observations",
+ "required_scopes": ["replay_scanner:read", "session_recording:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "replay-vision"
+ },
+ "vision-observations-retrieve": {
+ "description": "Get a single replay vision observation by ID, scoped to the scanners the caller can read. Returns the full `scanner_snapshot` (the scanner's configuration at run time) and `scanner_result` (the LLM output, with any event citations). Use `vision-observations-list` to find observation IDs for a session first.",
+ "category": "Replay vision",
+ "feature": "replay_vision",
+ "summary": "Get a session's replay vision observation",
+ "title": "Get a session's replay vision observation",
+ "required_scopes": ["replay_scanner:read", "session_recording:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "replay-vision"
+ },
+ "vision-quota-retrieve": {
+ "description": "Get the organization's monthly Replay Vision observation budget. Returns `monthly_quota`, `usage_this_month` (in-flight + succeeded observations counted against it), `remaining`, `exhausted`, and the `period_start`/`period_end` of the current calendar-month window. Check `remaining`/`exhausted` before creating a scanner or calling `vision-scanners-scan-session` — observations requested over quota are silently skipped until the next period. Pair with `vision-scanners-estimate-create` to size a new scanner against the remaining budget.",
+ "category": "Replay vision",
+ "feature": "replay_vision",
+ "summary": "Get replay vision quota",
+ "title": "Get replay vision quota",
+ "required_scopes": ["replay_scanner:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "replay-vision"
+ },
"vision-scanners-create": {
- "description": "Create a replay vision scanner. Pick a `scanner_type` — `monitor` (open-ended observations), `classifier` (assign a tag from a fixed label set), `scorer` (numeric rubric), or `summarizer` (free-text summary with optional facet embeddings via `emits_embeddings`) — and fill `scanner_config` to match: all types need a `prompt`; classifiers also need `tags`; scorers also need `scale`; summarizers optionally set `length` and `emits_embeddings`. `query` is a `RecordingsQuery` shape that defines which sessions the scanner watches — `date_from` and `date_to` are ignored (the schedule controls time). `sampling_rate` is a 0..1 random downsample applied after the query matches (default 1.0). `model` chooses the LLM. Names must be unique within the team.",
+ "description": "Create a replay vision scanner. Pick a `scanner_type` — `monitor` (open-ended observations), `classifier` (assign a tag from a fixed label set), `scorer` (numeric rubric), or `summarizer` (free-text summary with optional facet embeddings via `emits_embeddings`) — and fill `scanner_config` to match: all types need a `prompt`; classifiers also need `tags`; scorers also need `scale`; summarizers optionally set `length` and `emits_embeddings`. `query` is a `RecordingsQuery` shape that defines which sessions the scanner watches — `date_from` and `date_to` are ignored (the schedule controls time). `sampling_rate` is a 0..1 random downsample applied after the query matches (default 1.0). `model` chooses the LLM. Names must be unique within the team. Before creating a broad scanner (a permissive `query` and/or high `sampling_rate`), first call `vision-scanners-estimate-create` to project its monthly observation volume and `vision-quota-retrieve` to check the org's remaining budget — an enabled scanner sweeps matching recordings every 5 minutes, and creation itself does not check quota, so a too-broad scanner can exhaust the monthly budget on its first sweeps.",
"category": "Replay vision",
"feature": "replay_vision",
"summary": "Create replay vision scanner",
@@ -5460,6 +5505,21 @@
},
"feature_flag": "replay-vision"
},
+ "vision-scanners-estimate-create": {
+ "description": "Preview how many observations a proposed scanner would generate before saving it. Send a `query` (`RecordingsQuery` shape; `date_from`/`date_to` are ignored — the estimate uses a fixed 30-day lookback) and an optional `sampling_rate`. Returns `matched_sessions_in_window`, the `window_days` it was measured over, and `estimated_observations_per_month`. Enabled scanners sweep every 5 minutes, so a broad query can exhaust the monthly quota quickly — run this and compare against `vision-quota-retrieve` before `vision-scanners-create`.",
+ "category": "Replay vision",
+ "feature": "replay_vision",
+ "summary": "Estimate replay vision scanner volume",
+ "title": "Estimate replay vision scanner volume",
+ "required_scopes": ["replay_scanner:read", "session_recording:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "replay-vision"
+ },
"vision-scanners-get": {
"description": "Get a single replay vision scanner by ID. Returns the full configuration including `scanner_config` (the type-specific prompt and response schema parameters), the `RecordingsQuery` used to select sessions, and operational fields like `enabled`, `sampling_rate`, `provider`, `model`, `emits_signals`, `scanner_version`, and `last_swept_at`.",
"category": "Replay vision",
@@ -5506,7 +5566,7 @@
"feature_flag": "replay-vision"
},
"vision-scanners-observations-list": {
- "description": "List the observations recorded by a single scanner. Each observation is one scan of one session and includes its `status` (pending/running/succeeded/failed), `triggered_by` (`schedule` or `on_demand`), `workflow_id`, the `scanner_result` (the LLM output validated against the scanner's response schema for that scanner_type), and the `session_id` of the recording it analysed. Use this to inspect what a scanner has found over time.",
+ "description": "List the observations recorded by a single scanner. Each observation is one scan of one session and includes its `status` (pending/running/succeeded/failed/ineligible), `error_reason` (set on terminal non-success statuses, e.g. `too_short`/`no_recording` for ineligible or `provider_rejected`/`validation_failed` for failed — useful for triaging why a scan produced no result), `triggered_by` (`schedule` or `on_demand`), `workflow_id`, the `scanner_result` (the LLM output validated against the scanner's response schema for that scanner_type), and the `session_id` of the recording it analysed. Use this to inspect what a scanner has found over time; to see every scanner's observations for one session, use `vision-observations-list`.",
"category": "Replay vision",
"feature": "replay_vision",
"summary": "List scanner observations",
@@ -5521,7 +5581,7 @@
"feature_flag": "replay-vision"
},
"vision-scanners-scan-session": {
- "description": "Trigger a scanner against a specific session immediately, bypassing the sampling rate and any scheduled sweep. Returns 202 with a `workflow_id`; the resulting observation appears under `vision-scanners-observations-list` once the Temporal workflow finishes (typically several minutes — rasterising the recording into video and calling the LLM is slow). Useful for ad-hoc scanning during an investigation: pick a scanner that matches the question you want answered, and point it at the session you're examining.",
+ "description": "Trigger a scanner against a specific session immediately, bypassing the sampling rate and any scheduled sweep. Returns 202 with a `workflow_id`; the resulting observation appears under `vision-scanners-observations-list` once the Temporal workflow finishes (typically several minutes — rasterising the recording into video and calling the LLM is slow). Useful for ad-hoc scanning during an investigation: pick a scanner that matches the question you want answered, and point it at the session you're examining. A scanner can observe a given session only once — re-triggering it on a session that already has an observation (even a failed or ineligible one) is a no-op and will not produce a fresh scan.",
"category": "Replay vision",
"feature": "replay_vision",
"summary": "Run scanner against a session now",
@@ -5537,7 +5597,7 @@
"feature_flag": "replay-vision"
},
"vision-scanners-update": {
- "description": "Partially update a replay vision scanner by ID. Send only the fields you want to change. Common changes: toggle `enabled` to pause/resume scanning, adjust `sampling_rate`, tweak the `scanner_config` prompt or tags, or refine the `query` to watch a different slice of sessions. `scanner_type` is locked after creation — to change it, delete and recreate. Editing any config field bumps `scanner_version`; existing observations keep a snapshot of the previous config for reproducibility.",
+ "description": "Partially update a replay vision scanner by ID. Send only the fields you want to change. Common changes: toggle `enabled` to pause/resume scanning, adjust `sampling_rate`, tweak the `scanner_config` prompt or tags, or refine the `query` to watch a different slice of sessions. `scanner_type` is locked after creation — to change it, delete and recreate. Editing any config field bumps `scanner_version`; existing observations keep a snapshot of the previous config for reproducibility. If you widen the `query` or raise `sampling_rate`, re-check projected volume with `vision-scanners-estimate-create` and remaining budget with `vision-quota-retrieve` first — the scanner resumes sweeping every 5 minutes at the new, broader scope.",
"category": "Replay vision",
"feature": "replay_vision",
"summary": "Update replay vision scanner",
diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.json
index f0ec384852a5..f715917662da 100644
--- a/services/mcp/schema/tool-definitions-all.json
+++ b/services/mcp/schema/tool-definitions-all.json
@@ -5784,8 +5784,53 @@
"readOnlyHint": false
}
},
+ "vision-observations-list": {
+ "description": "List every replay vision observation recorded for a single session, across all scanners the caller can read. This is the \"what has Replay Vision found about this session?\" lookup — pair it with the session-recording MCP tools or the investigating-replay skill while investigating a recording. The `session_id` query parameter is REQUIRED; without it the request is rejected. Each result includes the scanner that produced it, the observation `status` (pending/running/succeeded/failed/ineligible), the `error_reason` for terminal non-success statuses, and the `scanner_result` (LLM output) on success. To list observations for one specific scanner over time instead, use `vision-scanners-observations-list`.",
+ "category": "Replay vision",
+ "feature": "replay_vision",
+ "summary": "List a session's replay vision observations",
+ "title": "List a session's replay vision observations",
+ "required_scopes": ["replay_scanner:read", "session_recording:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "replay-vision"
+ },
+ "vision-observations-retrieve": {
+ "description": "Get a single replay vision observation by ID, scoped to the scanners the caller can read. Returns the full `scanner_snapshot` (the scanner's configuration at run time) and `scanner_result` (the LLM output, with any event citations). Use `vision-observations-list` to find observation IDs for a session first.",
+ "category": "Replay vision",
+ "feature": "replay_vision",
+ "summary": "Get a session's replay vision observation",
+ "title": "Get a session's replay vision observation",
+ "required_scopes": ["replay_scanner:read", "session_recording:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "replay-vision"
+ },
+ "vision-quota-retrieve": {
+ "description": "Get the organization's monthly Replay Vision observation budget. Returns `monthly_quota`, `usage_this_month` (in-flight + succeeded observations counted against it), `remaining`, `exhausted`, and the `period_start`/`period_end` of the current calendar-month window. Check `remaining`/`exhausted` before creating a scanner or calling `vision-scanners-scan-session` — observations requested over quota are silently skipped until the next period. Pair with `vision-scanners-estimate-create` to size a new scanner against the remaining budget.",
+ "category": "Replay vision",
+ "feature": "replay_vision",
+ "summary": "Get replay vision quota",
+ "title": "Get replay vision quota",
+ "required_scopes": ["replay_scanner:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "replay-vision"
+ },
"vision-scanners-create": {
- "description": "Create a replay vision scanner. Pick a `scanner_type` — `monitor` (open-ended observations), `classifier` (assign a tag from a fixed label set), `scorer` (numeric rubric), or `summarizer` (free-text summary with optional facet embeddings via `emits_embeddings`) — and fill `scanner_config` to match: all types need a `prompt`; classifiers also need `tags`; scorers also need `scale`; summarizers optionally set `length` and `emits_embeddings`. `query` is a `RecordingsQuery` shape that defines which sessions the scanner watches — `date_from` and `date_to` are ignored (the schedule controls time). `sampling_rate` is a 0..1 random downsample applied after the query matches (default 1.0). `model` chooses the LLM. Names must be unique within the team.",
+ "description": "Create a replay vision scanner. Pick a `scanner_type` — `monitor` (open-ended observations), `classifier` (assign a tag from a fixed label set), `scorer` (numeric rubric), or `summarizer` (free-text summary with optional facet embeddings via `emits_embeddings`) — and fill `scanner_config` to match: all types need a `prompt`; classifiers also need `tags`; scorers also need `scale`; summarizers optionally set `length` and `emits_embeddings`. `query` is a `RecordingsQuery` shape that defines which sessions the scanner watches — `date_from` and `date_to` are ignored (the schedule controls time). `sampling_rate` is a 0..1 random downsample applied after the query matches (default 1.0). `model` chooses the LLM. Names must be unique within the team. Before creating a broad scanner (a permissive `query` and/or high `sampling_rate`), first call `vision-scanners-estimate-create` to project its monthly observation volume and `vision-quota-retrieve` to check the org's remaining budget — an enabled scanner sweeps matching recordings every 5 minutes, and creation itself does not check quota, so a too-broad scanner can exhaust the monthly budget on its first sweeps.",
"category": "Replay vision",
"feature": "replay_vision",
"summary": "Create replay vision scanner",
@@ -5815,6 +5860,21 @@
},
"feature_flag": "replay-vision"
},
+ "vision-scanners-estimate-create": {
+ "description": "Preview how many observations a proposed scanner would generate before saving it. Send a `query` (`RecordingsQuery` shape; `date_from`/`date_to` are ignored — the estimate uses a fixed 30-day lookback) and an optional `sampling_rate`. Returns `matched_sessions_in_window`, the `window_days` it was measured over, and `estimated_observations_per_month`. Enabled scanners sweep every 5 minutes, so a broad query can exhaust the monthly quota quickly — run this and compare against `vision-quota-retrieve` before `vision-scanners-create`.",
+ "category": "Replay vision",
+ "feature": "replay_vision",
+ "summary": "Estimate replay vision scanner volume",
+ "title": "Estimate replay vision scanner volume",
+ "required_scopes": ["replay_scanner:read", "session_recording:read"],
+ "annotations": {
+ "destructiveHint": false,
+ "idempotentHint": true,
+ "openWorldHint": true,
+ "readOnlyHint": true
+ },
+ "feature_flag": "replay-vision"
+ },
"vision-scanners-get": {
"description": "Get a single replay vision scanner by ID. Returns the full configuration including `scanner_config` (the type-specific prompt and response schema parameters), the `RecordingsQuery` used to select sessions, and operational fields like `enabled`, `sampling_rate`, `provider`, `model`, `emits_signals`, `scanner_version`, and `last_swept_at`.",
"category": "Replay vision",
@@ -5861,7 +5921,7 @@
"feature_flag": "replay-vision"
},
"vision-scanners-observations-list": {
- "description": "List the observations recorded by a single scanner. Each observation is one scan of one session and includes its `status` (pending/running/succeeded/failed), `triggered_by` (`schedule` or `on_demand`), `workflow_id`, the `scanner_result` (the LLM output validated against the scanner's response schema for that scanner_type), and the `session_id` of the recording it analysed. Use this to inspect what a scanner has found over time.",
+ "description": "List the observations recorded by a single scanner. Each observation is one scan of one session and includes its `status` (pending/running/succeeded/failed/ineligible), `error_reason` (set on terminal non-success statuses, e.g. `too_short`/`no_recording` for ineligible or `provider_rejected`/`validation_failed` for failed — useful for triaging why a scan produced no result), `triggered_by` (`schedule` or `on_demand`), `workflow_id`, the `scanner_result` (the LLM output validated against the scanner's response schema for that scanner_type), and the `session_id` of the recording it analysed. Use this to inspect what a scanner has found over time; to see every scanner's observations for one session, use `vision-observations-list`.",
"category": "Replay vision",
"feature": "replay_vision",
"summary": "List scanner observations",
@@ -5876,7 +5936,7 @@
"feature_flag": "replay-vision"
},
"vision-scanners-scan-session": {
- "description": "Trigger a scanner against a specific session immediately, bypassing the sampling rate and any scheduled sweep. Returns 202 with a `workflow_id`; the resulting observation appears under `vision-scanners-observations-list` once the Temporal workflow finishes (typically several minutes — rasterising the recording into video and calling the LLM is slow). Useful for ad-hoc scanning during an investigation: pick a scanner that matches the question you want answered, and point it at the session you're examining.",
+ "description": "Trigger a scanner against a specific session immediately, bypassing the sampling rate and any scheduled sweep. Returns 202 with a `workflow_id`; the resulting observation appears under `vision-scanners-observations-list` once the Temporal workflow finishes (typically several minutes — rasterising the recording into video and calling the LLM is slow). Useful for ad-hoc scanning during an investigation: pick a scanner that matches the question you want answered, and point it at the session you're examining. A scanner can observe a given session only once — re-triggering it on a session that already has an observation (even a failed or ineligible one) is a no-op and will not produce a fresh scan.",
"category": "Replay vision",
"feature": "replay_vision",
"summary": "Run scanner against a session now",
@@ -5892,7 +5952,7 @@
"feature_flag": "replay-vision"
},
"vision-scanners-update": {
- "description": "Partially update a replay vision scanner by ID. Send only the fields you want to change. Common changes: toggle `enabled` to pause/resume scanning, adjust `sampling_rate`, tweak the `scanner_config` prompt or tags, or refine the `query` to watch a different slice of sessions. `scanner_type` is locked after creation — to change it, delete and recreate. Editing any config field bumps `scanner_version`; existing observations keep a snapshot of the previous config for reproducibility.",
+ "description": "Partially update a replay vision scanner by ID. Send only the fields you want to change. Common changes: toggle `enabled` to pause/resume scanning, adjust `sampling_rate`, tweak the `scanner_config` prompt or tags, or refine the `query` to watch a different slice of sessions. `scanner_type` is locked after creation — to change it, delete and recreate. Editing any config field bumps `scanner_version`; existing observations keep a snapshot of the previous config for reproducibility. If you widen the `query` or raise `sampling_rate`, re-check projected volume with `vision-scanners-estimate-create` and remaining budget with `vision-quota-retrieve` first — the scanner resumes sweeping every 5 minutes at the new, broader scope.",
"category": "Replay vision",
"feature": "replay_vision",
"summary": "Update replay vision scanner",
diff --git a/services/mcp/src/generated/replay_vision/api.ts b/services/mcp/src/generated/replay_vision/api.ts
index c16b908fc1d7..d175c04bc894 100644
--- a/services/mcp/src/generated/replay_vision/api.ts
+++ b/services/mcp/src/generated/replay_vision/api.ts
@@ -3,11 +3,48 @@
* MCP service uses these Zod schemas for generated tool handlers.
* To regenerate: hogli build:openapi
*
- * PostHog API - MCP 8 enabled ops
+ * PostHog API - MCP 12 enabled ops
* OpenAPI spec version: 1.0.0
*/
import * as zod from 'zod'
+/**
+ * Read-only access to a session's observations across every scanner the caller can read, for the replay-page dock.
+ */
+export const VisionObservationsListParams = /* @__PURE__ */ zod.object({
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const VisionObservationsListQueryParams = /* @__PURE__ */ zod.object({
+ limit: zod.number().optional().describe('Number of results to return per page.'),
+ offset: zod.number().optional().describe('The initial index from which to return the results.'),
+ session_id: zod.string().describe('Session recording id to return observations for.'),
+})
+
+/**
+ * Read-only access to a session's observations across every scanner the caller can read, for the replay-page dock.
+ */
+export const VisionObservationsRetrieveParams = /* @__PURE__ */ zod.object({
+ id: zod.string().describe('A UUID string identifying this replay observation.'),
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const EnvironmentVisionQuotaRetrieveParams = /* @__PURE__ */ zod.object({
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
/**
* CRUD for Replay Vision scanners.
*/
@@ -280,3 +317,35 @@ export const VisionScannersObservationsRetrieveParams = /* @__PURE__ */ zod.obje
),
scanner_id: zod.string(),
})
+
+/**
+ * Estimate the observation volume a proposed scanner would generate, for the pre-save cost preview.
+ */
+export const VisionScannersEstimateCreateParams = /* @__PURE__ */ zod.object({
+ project_id: zod
+ .string()
+ .describe(
+ "Project ID of the project you're trying to access. To find the ID of the project, make a call to /api/projects/."
+ ),
+})
+
+export const visionScannersEstimateCreateBodySamplingRateDefault = 1
+export const visionScannersEstimateCreateBodySamplingRateMin = 0
+export const visionScannersEstimateCreateBodySamplingRateMax = 1
+
+export const VisionScannersEstimateCreateBody = /* @__PURE__ */ zod
+ .object({
+ query: zod
+ .unknown()
+ .optional()
+ .describe(
+ 'Proposed `RecordingsQuery` for the candidate filter. `date_from`/`date_to` are ignored — the estimate always uses a fixed 30-day lookback. Omit to estimate against all recordings.'
+ ),
+ sampling_rate: zod
+ .number()
+ .min(visionScannersEstimateCreateBodySamplingRateMin)
+ .max(visionScannersEstimateCreateBodySamplingRateMax)
+ .default(visionScannersEstimateCreateBodySamplingRateDefault)
+ .describe('0..1 downsample applied to matched sessions. Defaults to 1.0 (no downsampling).'),
+ })
+ .describe('Body of POST /vision/scanners/estimate/ — a proposed, unsaved scanner config.')
diff --git a/services/mcp/src/tools/generated/replay_vision.ts b/services/mcp/src/tools/generated/replay_vision.ts
index 139ab7bf84a5..fdd7239d70b0 100644
--- a/services/mcp/src/tools/generated/replay_vision.ts
+++ b/services/mcp/src/tools/generated/replay_vision.ts
@@ -3,8 +3,11 @@ import { z } from 'zod'
import type { Schemas } from '@/api/generated'
import {
+ VisionObservationsListQueryParams,
+ VisionObservationsRetrieveParams,
VisionScannersCreateBody,
VisionScannersDestroyParams,
+ VisionScannersEstimateCreateBody,
VisionScannersListQueryParams,
VisionScannersObservationsListParams,
VisionScannersObservationsListQueryParams,
@@ -18,6 +21,63 @@ import {
import { withPostHogUrl, type WithPostHogUrl } from '@/tools/tool-utils'
import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'
+const VisionObservationsListSchema = VisionObservationsListQueryParams
+
+const visionObservationsList = (): ToolBase<
+ typeof VisionObservationsListSchema,
+ WithPostHogUrl<Schemas.PaginatedReplayObservationList>
+> => ({
+ name: 'vision-observations-list',
+ schema: VisionObservationsListSchema,
+ handler: async (context: Context, params: z.infer<typeof VisionObservationsListSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.PaginatedReplayObservationList>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/observations/`,
+ query: {
+ limit: params.limit,
+ offset: params.offset,
+ session_id: params.session_id,
+ },
+ })
+ return await withPostHogUrl(context, result, '/replay-vision')
+ },
+})
+
+const VisionObservationsRetrieveSchema = VisionObservationsRetrieveParams.omit({ project_id: true })
+
+const visionObservationsRetrieve = (): ToolBase<
+ typeof VisionObservationsRetrieveSchema,
+ Schemas.ReplayObservation
+> => ({
+ name: 'vision-observations-retrieve',
+ schema: VisionObservationsRetrieveSchema,
+ handler: async (context: Context, params: z.infer<typeof VisionObservationsRetrieveSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.ReplayObservation>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/observations/${encodeURIComponent(String(params.id))}/`,
+ })
+ return result
+ },
+})
+
+const VisionQuotaRetrieveSchema = z.object({})
+
+const visionQuotaRetrieve = (): ToolBase<typeof VisionQuotaRetrieveSchema, Schemas.VisionQuota> => ({
+ name: 'vision-quota-retrieve',
+ schema: VisionQuotaRetrieveSchema,
+ // eslint-disable-next-line no-unused-vars
+ handler: async (context: Context, params: z.infer<typeof VisionQuotaRetrieveSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const result = await context.api.request<Schemas.VisionQuota>({
+ method: 'GET',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/quota/`,
+ })
+ return result
+ },
+})
+
const VisionScannersCreateSchema = VisionScannersCreateBody
const visionScannersCreate = (): ToolBase<typeof VisionScannersCreateSchema, Schemas.ReplayScanner> => ({
@@ -80,6 +140,32 @@ const visionScannersDelete = (): ToolBase<typeof VisionScannersDeleteSchema, unk
},
})
+const VisionScannersEstimateCreateSchema = VisionScannersEstimateCreateBody
+
+const visionScannersEstimateCreate = (): ToolBase<
+ typeof VisionScannersEstimateCreateSchema,
+ Schemas.EstimateResponse
+> => ({
+ name: 'vision-scanners-estimate-create',
+ schema: VisionScannersEstimateCreateSchema,
+ handler: async (context: Context, params: z.infer<typeof VisionScannersEstimateCreateSchema>) => {
+ const projectId = await context.stateManager.getProjectId()
+ const body: Record<string, unknown> = {}
+ if (params.query !== undefined) {
+ body['query'] = params.query
+ }
+ if (params.sampling_rate !== undefined) {
+ body['sampling_rate'] = params.sampling_rate
+ }
+ const result = await context.api.request<Schemas.EstimateResponse>({
+ method: 'POST',
+ path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/scanners/estimate/`,
+ body,
+ })
+ return result
+ },
+})
+
const VisionScannersGetSchema = VisionScannersRetrieveParams.omit({ project_id: true })
const visionScannersGet = (): ToolBase<typeof VisionScannersGetSchema, Schemas.ReplayScanner> => ({
@@ -239,8 +325,12 @@ const visionScannersUpdate = (): ToolBase<typeof VisionScannersUpdateSchema, Sch
})
export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {
+ 'vision-observations-list': visionObservationsList,
+ 'vision-observations-retrieve': visionObservationsRetrieve,
+ 'vision-quota-retrieve': visionQuotaRetrieve,
'vision-scanners-create': visionScannersCreate,
'vision-scanners-delete': visionScannersDelete,
+ 'vision-scanners-estimate-create': visionScannersEstimateCreate,
'vision-scanners-get': visionScannersGet,
'vision-scanners-list': visionScannersList,
'vision-scanners-observations-get': visionScannersObservationsGet,