: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(replay-vision): expose vision action group-summary MCP tools (#73296)
Kim Svatos Dugan6a3337661e93
diff --git a/frontend/src/lib/agentScopes.generated.ts b/frontend/src/lib/agentScopes.generated.tsindex e47c17a500ed..c9c1cf5705ba 100644--- a/frontend/src/lib/agentScopes.generated.ts+++ b/frontend/src/lib/agentScopes.generated.ts@@ -127,6 +127,7 @@ export const AGENT_USE_CASE_SCOPES = ['user:write','user_interview:read','user_interview:write',+ 'vision_action:read','visual_review:read','visual_review:write','warehouse_table:read',diff --git a/products/replay_vision/mcp/tools.yaml b/products/replay_vision/mcp/tools.yamlindex 57b1c2366621..2a1f4ea9f7b8 100644--- a/products/replay_vision/mcp/tools.yaml+++ b/products/replay_vision/mcp/tools.yaml@@ -17,19 +17,81 @@ tools:enabled: falsevision-actions-list:operation: vision_actions_list- enabled: false+ enabled: true+ scopes:+ - vision_action:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ list: true+ title: List vision actions+ description: >+ List the vision actions (the "and then…" automations that run over a scanner's observations) for the current+ project. A vision action in `mode: group_summary` produces the group summary shown on the "Summaries and+ alerts" tab — one report synthesized from up to `max_observations` observations of its bound scanner; `mode:+ alert` delivers only when its alert condition holds. Each row carries the bound `scanner`, `mode`,+ `trigger_type`, cadence, and `is_scanner_digest` (the built-in daily digest). Pass `?scanner=<id>` to filter+ to one scanner. To read a specific action's produced reports, list its runs with `vision-actions-runs-list`.+ feature_flag: replay-visionvision-actions-partial-update:operation: vision_actions_partial_updateenabled: falsevision-actions-retrieve:operation: vision_actions_retrieve- enabled: false+ enabled: true+ scopes:+ - vision_action:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ title: Get a vision action+ description: >+ Get a single vision action by ID. Returns its configuration: the bound `scanner`, `mode`+ (group_summary/alert), `selection` (the observation-targeting predicate — verdict/tags/score bounds/window),+ `synthesis_config`, `alert_config`, cadence, and delivery targets. Use `vision-actions-runs-list` ++ `vision-actions-runs-retrieve` to read the reports it has actually produced.+ feature_flag: replay-visionvision-actions-runs-list:operation: vision_actions_runs_list- enabled: false+ enabled: true+ scopes:+ - vision_action:read+ - session_recording:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ list: true+ title: List a vision action's runs+ description: >+ List the run history for one vision action (nested under the action). Each run is one execution that+ produced a group summary or evaluated an alert. Rows are lightweight — `status`+ (running/completed/failed/skipped), `scheduled_at`, `observation_count` (how many observations fed the+ summary), `error_reason`, and `is_recovery` — without the report body. Fetch a completed run with+ `vision-actions-runs-retrieve` to get the synthesized report and the observations it cited.+ feature_flag: replay-visionvision-actions-runs-retrieve:operation: vision_actions_runs_retrieve- enabled: false+ enabled: true+ scopes:+ - vision_action:read+ - session_recording:read+ annotations:+ readOnly: true+ destructive: false+ idempotent: true+ title: Get a vision action run's full group summary+ description: >+ Get one vision action run in full: `synthesized_markdown` (the group-summary report, which cites its source+ observations inline with `[obs N]` markers) and `observations` — the recordings the run included, in summary+ order, each carrying the 1-based `index` that the report's `[obs N]` markers reference plus that+ observation's title and outcome. This is the tool for auditing a group summary: for each `[obs N]` in the+ markdown, `observations[N-1]` is the observation it cites, so you can check whether the cited observation+ actually supports the claim. Empty `synthesized_markdown`/`observations` means the run skipped, failed, or+ predates observation tracking.+ feature_flag: replay-visionvision-observations-create-task-create:operation: vision_observations_create_task_createenabled: falsediff --git a/services/mcp/schema/generated-tool-definitions.json b/services/mcp/schema/generated-tool-definitions.jsonindex 18dc624e2072..74bf66af7fb5 100644--- a/services/mcp/schema/generated-tool-definitions.json+++ b/services/mcp/schema/generated-tool-definitions.json@@ -9742,6 +9742,66 @@"readOnlyHint": false}},+ "vision-actions-list": {+ "description": "List the vision actions (the \"and then…\" automations that run over a scanner's observations) for the current project. A vision action in `mode: group_summary` produces the group summary shown on the \"Summaries and alerts\" tab — one report synthesized from up to `max_observations` observations of its bound scanner; `mode: alert` delivers only when its alert condition holds. Each row carries the bound `scanner`, `mode`, `trigger_type`, cadence, and `is_scanner_digest` (the built-in daily digest). Pass `?scanner=<id>` to filter to one scanner. To read a specific action's produced reports, list its runs with `vision-actions-runs-list`.",+ "category": "Replay vision",+ "feature": "replay_vision",+ "summary": "List vision actions",+ "title": "List vision actions",+ "required_scopes": ["vision_action:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "replay-vision"+ },+ "vision-actions-retrieve": {+ "description": "Get a single vision action by ID. Returns its configuration: the bound `scanner`, `mode` (group_summary/alert), `selection` (the observation-targeting predicate — verdict/tags/score bounds/window), `synthesis_config`, `alert_config`, cadence, and delivery targets. Use `vision-actions-runs-list` + `vision-actions-runs-retrieve` to read the reports it has actually produced.",+ "category": "Replay vision",+ "feature": "replay_vision",+ "summary": "Get a vision action",+ "title": "Get a vision action",+ "required_scopes": ["vision_action:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "replay-vision"+ },+ "vision-actions-runs-list": {+ "description": "List the run history for one vision action (nested under the action). Each run is one execution that produced a group summary or evaluated an alert. Rows are lightweight — `status` (running/completed/failed/skipped), `scheduled_at`, `observation_count` (how many observations fed the summary), `error_reason`, and `is_recovery` — without the report body. Fetch a completed run with `vision-actions-runs-retrieve` to get the synthesized report and the observations it cited.",+ "category": "Replay vision",+ "feature": "replay_vision",+ "summary": "List a vision action's runs",+ "title": "List a vision action's runs",+ "required_scopes": ["vision_action:read", "session_recording:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "replay-vision"+ },+ "vision-actions-runs-retrieve": {+ "description": "Get one vision action run in full: `synthesized_markdown` (the group-summary report, which cites its source observations inline with `[obs N]` markers) and `observations` — the recordings the run included, in summary order, each carrying the 1-based `index` that the report's `[obs N]` markers reference plus that observation's title and outcome. This is the tool for auditing a group summary: for each `[obs N]` in the markdown, `observations[N-1]` is the observation it cites, so you can check whether the cited observation actually supports the claim. Empty `synthesized_markdown`/`observations` means the run skipped, failed, or predates observation tracking.",+ "category": "Replay vision",+ "feature": "replay_vision",+ "summary": "Get a vision action run's full group summary",+ "title": "Get a vision action run's full group summary",+ "required_scopes": ["vision_action:read", "session_recording:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "replay-vision"+ },"vision-observations-label-create": {"description": "Set or update the shared thumbs up/down rating on a replay scanner observation: `is_correct` true means the scanner got the session right (thumbs up), false means it got it wrong (thumbs down), plus optional written `feedback` explaining why (applies to both directions). One shared rating per observation, team-wide, last write wins; re-posting updates it in place. These ratings power the scanner's Quality tab: the quality-over-time chart and the AI prompt recommendations (see `vision-scanners-prompt-suggestions-generate`). Find observation IDs via `vision-scanners-observations-list` (filter `labeled=false` for unrated ones) or `vision-observations-list` for a session.","category": "Replay vision",diff --git a/services/mcp/schema/tool-definitions-all.json b/services/mcp/schema/tool-definitions-all.jsonindex 5c1a0274d77d..c6daa3152387 100644--- a/services/mcp/schema/tool-definitions-all.json+++ b/services/mcp/schema/tool-definitions-all.json@@ -10335,6 +10335,66 @@"readOnlyHint": false}},+ "vision-actions-list": {+ "description": "List the vision actions (the \"and then…\" automations that run over a scanner's observations) for the current project. A vision action in `mode: group_summary` produces the group summary shown on the \"Summaries and alerts\" tab — one report synthesized from up to `max_observations` observations of its bound scanner; `mode: alert` delivers only when its alert condition holds. Each row carries the bound `scanner`, `mode`, `trigger_type`, cadence, and `is_scanner_digest` (the built-in daily digest). Pass `?scanner=<id>` to filter to one scanner. To read a specific action's produced reports, list its runs with `vision-actions-runs-list`.",+ "category": "Replay vision",+ "feature": "replay_vision",+ "summary": "List vision actions",+ "title": "List vision actions",+ "required_scopes": ["vision_action:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "replay-vision"+ },+ "vision-actions-retrieve": {+ "description": "Get a single vision action by ID. Returns its configuration: the bound `scanner`, `mode` (group_summary/alert), `selection` (the observation-targeting predicate — verdict/tags/score bounds/window), `synthesis_config`, `alert_config`, cadence, and delivery targets. Use `vision-actions-runs-list` + `vision-actions-runs-retrieve` to read the reports it has actually produced.",+ "category": "Replay vision",+ "feature": "replay_vision",+ "summary": "Get a vision action",+ "title": "Get a vision action",+ "required_scopes": ["vision_action:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "replay-vision"+ },+ "vision-actions-runs-list": {+ "description": "List the run history for one vision action (nested under the action). Each run is one execution that produced a group summary or evaluated an alert. Rows are lightweight — `status` (running/completed/failed/skipped), `scheduled_at`, `observation_count` (how many observations fed the summary), `error_reason`, and `is_recovery` — without the report body. Fetch a completed run with `vision-actions-runs-retrieve` to get the synthesized report and the observations it cited.",+ "category": "Replay vision",+ "feature": "replay_vision",+ "summary": "List a vision action's runs",+ "title": "List a vision action's runs",+ "required_scopes": ["vision_action:read", "session_recording:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "replay-vision"+ },+ "vision-actions-runs-retrieve": {+ "description": "Get one vision action run in full: `synthesized_markdown` (the group-summary report, which cites its source observations inline with `[obs N]` markers) and `observations` — the recordings the run included, in summary order, each carrying the 1-based `index` that the report's `[obs N]` markers reference plus that observation's title and outcome. This is the tool for auditing a group summary: for each `[obs N]` in the markdown, `observations[N-1]` is the observation it cites, so you can check whether the cited observation actually supports the claim. Empty `synthesized_markdown`/`observations` means the run skipped, failed, or predates observation tracking.",+ "category": "Replay vision",+ "feature": "replay_vision",+ "summary": "Get a vision action run's full group summary",+ "title": "Get a vision action run's full group summary",+ "required_scopes": ["vision_action:read", "session_recording:read"],+ "annotations": {+ "destructiveHint": false,+ "idempotentHint": true,+ "openWorldHint": true,+ "readOnlyHint": true+ },+ "feature_flag": "replay-vision"+ },"vision-observations-label-create": {"description": "Set or update the shared thumbs up/down rating on a replay scanner observation: `is_correct` true means the scanner got the session right (thumbs up), false means it got it wrong (thumbs down), plus optional written `feedback` explaining why (applies to both directions). One shared rating per observation, team-wide, last write wins; re-posting updates it in place. These ratings power the scanner's Quality tab: the quality-over-time chart and the AI prompt recommendations (see `vision-scanners-prompt-suggestions-generate`). Find observation IDs via `vision-scanners-observations-list` (filter `labeled=false` for unrated ones) or `vision-observations-list` for a session.","category": "Replay vision",diff --git a/services/mcp/src/generated/replay_vision/api.ts b/services/mcp/src/generated/replay_vision/api.tsindex 001cdfea8831..045478a33a0a 100644--- a/services/mcp/src/generated/replay_vision/api.ts+++ b/services/mcp/src/generated/replay_vision/api.ts@@ -3,11 +3,70 @@* MCP service uses these Zod schemas for generated tool handlers.* To regenerate: hogli build:openapi*- * PostHog API - MCP 21 enabled ops+ * PostHog API - MCP 25 enabled ops* OpenAPI spec version: 1.0.0*/import * as zod from 'zod'+/**+ * CRUD for Replay Vision actions — scheduled "and then…" automations over a scanner's observations.+ */+export const VisionActionsListParams = /* @__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 VisionActionsListQueryParams = /* @__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.'),+ scanner: zod.string().optional().describe('Filter to the actions belonging to one scanner.'),+})++/**+ * CRUD for Replay Vision actions — scheduled "and then…" automations over a scanner's observations.+ */+export const VisionActionsRetrieveParams = /* @__PURE__ */ zod.object({+ id: zod.string().describe('A UUID string identifying this vision action.'),+ 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/."+ ),+})++/**+ * Read-only run history for a single vision action (nested under /vision/actions/{action_id}/runs/).+ */+export const VisionActionsRunsListParams = /* @__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/."+ ),+ vision_action_id: zod.string(),+})++export const VisionActionsRunsListQueryParams = /* @__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.'),+})++/**+ * Read-only run history for a single vision action (nested under /vision/actions/{action_id}/runs/).+ */+export const VisionActionsRunsRetrieveParams = /* @__PURE__ */ zod.object({+ id: zod.string().describe('A UUID string identifying this vision action run.'),+ 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/."+ ),+ vision_action_id: zod.string(),+})+/*** Read-only access to a session's observations across every scanner the caller can read, for the replay-page dock.*/diff --git a/services/mcp/src/tools/generated/replay_vision.ts b/services/mcp/src/tools/generated/replay_vision.tsindex b0ab3d84160d..b585362ea18e 100644--- a/services/mcp/src/tools/generated/replay_vision.ts+++ b/services/mcp/src/tools/generated/replay_vision.ts@@ -3,6 +3,11 @@ import { z } from 'zod'import type { Schemas } from '@/api/generated'import {+ VisionActionsListQueryParams,+ VisionActionsRetrieveParams,+ VisionActionsRunsListParams,+ VisionActionsRunsListQueryParams,+ VisionActionsRunsRetrieveParams,VisionObservationsLabelCreateBody,VisionObservationsLabelCreateParams,VisionObservationsLabelDestroyParams,@@ -37,6 +42,83 @@ import {import { withPostHogUrl, type WithPostHogUrl } from '@/tools/tool-utils'import type { Context, ToolBase, ZodObjectAny } from '@/tools/types'+const VisionActionsListSchema = VisionActionsListQueryParams++const visionActionsList = (): ToolBase<+ typeof VisionActionsListSchema,+ WithPostHogUrl<Schemas.PaginatedVisionActionList>+> => ({+ name: 'vision-actions-list',+ schema: VisionActionsListSchema,+ handler: async (context: Context, params: z.infer<typeof VisionActionsListSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.PaginatedVisionActionList>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/actions/`,+ query: {+ limit: params.limit,+ offset: params.offset,+ scanner: params.scanner,+ },+ })+ return await withPostHogUrl(context, result, '/replay-vision')+ },+})++const VisionActionsRetrieveSchema = VisionActionsRetrieveParams.omit({ project_id: true })++const visionActionsRetrieve = (): ToolBase<typeof VisionActionsRetrieveSchema, Schemas.VisionAction> => ({+ name: 'vision-actions-retrieve',+ schema: VisionActionsRetrieveSchema,+ handler: async (context: Context, params: z.infer<typeof VisionActionsRetrieveSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.VisionAction>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/actions/${encodeURIComponent(String(params.id))}/`,+ })+ return result+ },+})++const VisionActionsRunsListSchema = VisionActionsRunsListParams.omit({ project_id: true }).extend(+ VisionActionsRunsListQueryParams.shape+)++const visionActionsRunsList = (): ToolBase<+ typeof VisionActionsRunsListSchema,+ WithPostHogUrl<Schemas.PaginatedVisionActionRunListList>+> => ({+ name: 'vision-actions-runs-list',+ schema: VisionActionsRunsListSchema,+ handler: async (context: Context, params: z.infer<typeof VisionActionsRunsListSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.PaginatedVisionActionRunListList>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/actions/${encodeURIComponent(String(params.vision_action_id))}/runs/`,+ query: {+ limit: params.limit,+ offset: params.offset,+ },+ })+ return await withPostHogUrl(context, result, '/replay-vision')+ },+})++const VisionActionsRunsRetrieveSchema = VisionActionsRunsRetrieveParams.omit({ project_id: true })++const visionActionsRunsRetrieve = (): ToolBase<typeof VisionActionsRunsRetrieveSchema, Schemas.VisionActionRun> => ({+ name: 'vision-actions-runs-retrieve',+ schema: VisionActionsRunsRetrieveSchema,+ handler: async (context: Context, params: z.infer<typeof VisionActionsRunsRetrieveSchema>) => {+ const projectId = await context.stateManager.getProjectId()+ const result = await context.api.request<Schemas.VisionActionRun>({+ method: 'GET',+ path: `/api/projects/${encodeURIComponent(String(projectId))}/vision/actions/${encodeURIComponent(String(params.vision_action_id))}/runs/${encodeURIComponent(String(params.id))}/`,+ })+ return result+ },+})+const VisionObservationsLabelCreateSchema = VisionObservationsLabelCreateParams.omit({ project_id: true }).extend(VisionObservationsLabelCreateBody.shape)@@ -613,6 +695,10 @@ const visionScannersUpdate = (): ToolBase<typeof VisionScannersUpdateSchema, Sch})export const GENERATED_TOOLS: Record<string, () => ToolBase<ZodObjectAny>> = {+ 'vision-actions-list': visionActionsList,+ 'vision-actions-retrieve': visionActionsRetrieve,+ 'vision-actions-runs-list': visionActionsRunsList,+ 'vision-actions-runs-retrieve': visionActionsRunsRetrieve,'vision-observations-label-create': visionObservationsLabelCreate,'vision-observations-label-destroy': visionObservationsLabelDestroy,'vision-observations-list': visionObservationsList,