: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
fix(mcp): keep showAnnotations on sql insights saved through mcp (#129859)
posthog[bot]7907445ff937
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.jsonindex 341ebe61d1b0..46e49a87507e 100644--- a/frontend/src/queries/schema.json+++ b/frontend/src/queries/schema.json@@ -2782,6 +2782,10 @@"description": "Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable. A breakdown buckets rows by x value, so it is ignored when `display` is `ScatterPlot`.","type": ["string", "null"]},+ "showAnnotations": {+ "description": "Show annotations on the chart. Only applies to line, area, bar, and stacked bar charts whose X axis is a date or datetime column.",+ "type": "boolean"+ },"showLegend": {"description": "Show the chart legend.","type": "boolean"diff --git a/frontend/src/queries/schema/schema-assistant-queries.ts b/frontend/src/queries/schema/schema-assistant-queries.tsindex 9629bafcf33b..79e60b6a965a 100644--- a/frontend/src/queries/schema/schema-assistant-queries.ts+++ b/frontend/src/queries/schema/schema-assistant-queries.ts@@ -2032,6 +2032,11 @@ export interface AssistantDataVisualizationChartSettings {showLegend?: boolean/** Where the legend sits. Defaults to right for pie and donut, top for other charts. */legendPosition?: 'top' | 'bottom' | 'left' | 'right'+ /**+ * Show annotations on the chart. Only applies to line, area, bar, and stacked bar charts+ * whose X axis is a date or datetime column.+ */+ showAnnotations?: boolean/** Settings for `ActionsPie` and `ActionsDonut`. */pie?: PieChartSettings/** Settings for `Metric`. `summary` defaults to `latest`. */diff --git a/posthog/schema.py b/posthog/schema.pyindex 41328e4904b1..22f6f763c2da 100644--- a/posthog/schema.py+++ b/posthog/schema.py@@ -10547,6 +10547,13 @@ class AssistantDataVisualizationChartSettings(BaseModel):" `display` is `ScatterPlot`."),)+ showAnnotations: bool | None = Field(+ default=None,+ description=(+ "Show annotations on the chart. Only applies to line, area, bar, and"+ " stacked bar charts whose X axis is a date or datetime column."+ ),+ )showLegend: bool | None = Field(default=None, description="Show the chart legend.")showNullsAsZero: bool | None = Field(default=None, description="Replace null aggregation results with zero.")showTotalRow: bool | None = Field(diff --git a/services/mcp/src/tools/generated/product_analytics.ts b/services/mcp/src/tools/generated/product_analytics.tsindex a1724e5ce5c7..0ca668e1af4e 100644--- a/services/mcp/src/tools/generated/product_analytics.ts+++ b/services/mcp/src/tools/generated/product_analytics.ts@@ -224,6 +224,12 @@ const AssistantDataVisualizationChartSettings = z.object({'Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable. A breakdown buckets rows by x value, so it is ignored when `display` is `ScatterPlot`.').optional(),+ showAnnotations: z.coerce+ .boolean()+ .describe(+ 'Show annotations on the chart. Only applies to line, area, bar, and stacked bar charts whose X axis is a date or datetime column.'+ )+ .optional(),showLegend: z.coerce.boolean().describe('Show the chart legend.').optional(),showNullsAsZero: z.coerce.boolean().describe('Replace null aggregation results with zero.').optional(),showTotalRow: z.coercediff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-create.jsonindex f4e0a4f6e767..83ce5aaa35f2 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-create.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-create.json@@ -327,6 +327,10 @@],"description": "Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable. A breakdown buckets rows by x value, so it is ignored when `display` is `ScatterPlot`."},+ "showAnnotations": {+ "description": "Show annotations on the chart. Only applies to line, area, bar, and stacked bar charts whose X axis is a date or datetime column.",+ "type": "boolean"+ },"showLegend": {"description": "Show the chart legend.","type": "boolean"diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-update.jsonindex e382046b0cfa..c7cb83b71672 100644--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-update.json+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-update.json@@ -338,6 +338,10 @@],"description": "Column that splits a single Y series into multiple colored series — e.g. breaking down a line chart by `country`. Set to `null` or omit to disable. A breakdown buckets rows by x value, so it is ignored when `display` is `ScatterPlot`."},+ "showAnnotations": {+ "description": "Show annotations on the chart. Only applies to line, area, bar, and stacked bar charts whose X axis is a date or datetime column.",+ "type": "boolean"+ },"showLegend": {"description": "Show the chart legend.","type": "boolean"diff --git a/services/mcp/tests/unit/insight-query-shapes.test.ts b/services/mcp/tests/unit/insight-query-shapes.test.tsindex 6e6c43112f83..5a0c7e392e4c 100644--- a/services/mcp/tests/unit/insight-query-shapes.test.ts+++ b/services/mcp/tests/unit/insight-query-shapes.test.ts@@ -22,6 +22,7 @@ const acceptedQueries = [query: {kind: 'DataVisualizationNode',source: { kind: 'HogQLQuery', query: 'select 1 as value' },+ chartSettings: { legendPosition: 'bottom', showAnnotations: true },tableSettings: {columns: [{ column: 'value', settings: { display: { description: 'Value in USD' } } }],},