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(insights): add descriptions to sql table columns (#124534)

Jovan Sakovicab63a9222540
diff --git a/docs/published/handbook/engineering/ai/implementing-mcp-tools.md b/docs/published/handbook/engineering/ai/implementing-mcp-tools.md
index 6289f8936051..5841d2aeb8e3 100644
--- a/docs/published/handbook/engineering/ai/implementing-mcp-tools.md
+++ b/docs/published/handbook/engineering/ai/implementing-mcp-tools.md
@@ -885,6 +885,9 @@ the goal is to make it easier to generate HogQL queries from typed schemas
than from freeform SQL.
A `schema.json` integration into the codegen pipeline is planned.
+For SQL table insights, set `query.tableSettings.columns[].settings.display.description` in `insight-create` or `insight-update`.
+For updates, read the saved query first and retain its other fields.
+
## Agent skills that support the MCP server
- **`querying-posthog-data`** – HogQL query patterns, system model schemas, and available functions.
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.test.tsx b/frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.test.tsx
index 020b279096d8..59b334ddd4ed 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.test.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.test.tsx
@@ -147,7 +147,10 @@ describe('SeriesTab', () => {
expect(await screen.findByText('Display')).toBeInTheDocument()
})
- it('persists table column formatting changes immediately', async () => {
+ it.each([
+ { setting: 'formatting', field: 'decimalPlaces', value: 2 },
+ { setting: 'display', field: 'description', value: 'Value in USD' },
+ ])('persists table column $field changes immediately', async ({ setting, field, value }) => {
initKeaTests()
const setQuery = jest.fn()
@@ -212,14 +215,21 @@ describe('SeriesTab', () => {
render(
<BindLogic logic={dataVisualizationLogic} props={props}>
- <YSeriesFormattingTab ySeriesLogicProps={ySeriesLogicProps} />
+ {setting === 'formatting' ? (
+ <YSeriesFormattingTab ySeriesLogicProps={ySeriesLogicProps} />
+ ) : (
+ <YSeriesDisplayTab ySeriesLogicProps={ySeriesLogicProps} />
+ )}
</BindLogic>
)
const user = userEvent.setup()
- const decimalPlacesInput = await screen.findByRole('spinbutton')
- await user.clear(decimalPlacesInput)
- await user.type(decimalPlacesInput, '2')
+ const input =
+ setting === 'formatting'
+ ? await screen.findByRole('spinbutton')
+ : await screen.findByLabelText('Description')
+ await user.clear(input)
+ await user.type(input, String(value))
await waitFor(() =>
expect(setQuery).toHaveBeenLastCalledWith(
@@ -229,9 +239,7 @@ describe('SeriesTab', () => {
expect.objectContaining({
column: 'value',
settings: expect.objectContaining({
- formatting: expect.objectContaining({
- decimalPlaces: 2,
- }),
+ [setting]: expect.objectContaining({ [field]: value }),
}),
}),
]),
@@ -239,6 +247,26 @@ describe('SeriesTab', () => {
})
)
)
+
+ if (setting === 'display') {
+ await user.clear(input)
+ await waitFor(() =>
+ expect(setQuery).toHaveBeenLastCalledWith(
+ expect.objectContaining({
+ tableSettings: expect.objectContaining({
+ columns: expect.arrayContaining([
+ expect.objectContaining({
+ column: 'value',
+ settings: expect.objectContaining({
+ display: expect.objectContaining({ description: '' }),
+ }),
+ }),
+ ]),
+ }),
+ })
+ )
+ )
+ }
})
it('persists area as a y-axis display type', async () => {
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.tsx b/frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.tsx
index b516c077febc..3a46289e33de 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/SeriesTab.tsx
@@ -1,5 +1,6 @@
import { useActions, useValues } from 'kea'
import { Form } from 'kea-forms'
+import posthog from 'posthog-js'
import { IconGear, IconInfo, IconPlusSmall, IconTrash } from '@posthog/icons'
import {
@@ -14,6 +15,7 @@ import {
LemonSwitch,
LemonTabs,
LemonTag,
+ LemonTextArea,
Popover,
Tooltip,
} from '@posthog/lemon-ui'
@@ -404,7 +406,12 @@ const YSeries = ({ series, index }: { series: AxisSeries<number | null>; index:
icon={<IconGear />}
noPadding
data-attr="y-series-settings"
- onClick={() => setSettingsOpen(true)}
+ onClick={() => {
+ posthog.capture('sql column settings opened', {
+ query_kind: dataVisualizationProps.query.kind,
+ })
+ setSettingsOpen(true)
+ }}
disabledReason={!canOpenSettings && 'Select a column first'}
/>
</Popover>
@@ -612,6 +619,22 @@ export const YSeriesDisplayTab = ({ ySeriesLogicProps }: { ySeriesLogicProps: YS
)}
</div>
)}
+ {showTableSettings && (
+ <LemonField name="description" label="Description">
+ {({ value, onChange }) => (
+ <LemonTextArea
+ value={value ?? ''}
+ placeholder="Explain what this column contains"
+ onChange={(description) => {
+ onChange(description)
+ updateSeriesIndex(ySeriesLogicProps.seriesIndex, ySeriesLogicProps.series.column.name, {
+ display: { description },
+ })
+ }}
+ />
+ )}
+ </LemonField>
+ )}
{!showTableSettings && !hideChartSpecificOptions && (
<>
{!selectedSeriesBreakdownColumn &&
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Table.render.test.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Table.render.test.tsx
index 43c8513916e2..748d528d247d 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Table.render.test.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Table.render.test.tsx
@@ -3,6 +3,7 @@ import { MOCK_DEFAULT_USER } from 'lib/api.mock'
import '@testing-library/jest-dom'
import { act, cleanup, fireEvent, render, screen, waitFor } from '@testing-library/react'
+import userEvent from '@testing-library/user-event'
import { BindLogic } from 'kea'
import * as hog from 'lib/hog'
@@ -104,6 +105,40 @@ describe('SQL table rendering', () => {
expect(onInspect).toHaveBeenLastCalledWith({ region: 'EU', value: 0 })
})
+ it.each([false, true])(
+ 'shows a column description on keyboard focus without sorting, transpose=%s',
+ async (transpose) => {
+ const node: VisualizationNode = {
+ ...query,
+ tableSettings: {
+ ...query.tableSettings,
+ transpose,
+ columns: [
+ { column: 'region', settings: { display: { description: 'Region of the deployment' } } },
+ { column: 'value' },
+ ],
+ },
+ }
+ const { props, sourceProps, logic } = mountResult(node, response)
+ render(
+ <BindLogic logic={dataNodeLogic} props={sourceProps}>
+ <BindLogic logic={dataVisualizationLogic} props={props}>
+ <Table query={node} uniqueKey={props.key} context={{}} cachedResults={response} />
+ </BindLogic>
+ </BindLogic>
+ )
+
+ expect(screen.queryByLabelText('Description for value')).not.toBeInTheDocument()
+ const trigger = screen.getByLabelText('Description for region')
+ const user = userEvent.setup()
+ await user.tab()
+ expect(trigger).toHaveFocus()
+ expect(await screen.findByText('Region of the deployment')).toBeVisible()
+ await user.click(trigger)
+ expect(logic.values.hasSortedTable).toBe(false)
+ }
+ )
+
it('updates conditional cell colors when rules and results change', async () => {
const rule: ConditionalFormattingRule = {
id: 'equals',
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/Table.tsx b/frontend/src/queries/nodes/DataVisualization/Components/Table.tsx
index de948f699e13..a0f86cda0687 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/Table.tsx
+++ b/frontend/src/queries/nodes/DataVisualization/Components/Table.tsx
@@ -1,12 +1,14 @@
import '../../DataTable/DataTable.scss'
import { useActions, useValues } from 'kea'
+import posthog from 'posthog-js'
import React, { useCallback, useLayoutEffect, useMemo, useRef, useState } from 'react'
-import { IconPin, IconPinFilled } from '@posthog/icons'
+import { IconInfo, IconPin, IconPinFilled } from '@posthog/icons'
import { LemonBanner, LemonButton, LemonTable, LemonTableColumn, Tooltip } from '@posthog/lemon-ui'
import { dayjs } from 'lib/dayjs'
+import { cn } from 'lib/utils/css-classes'
import { InsightEmptyState, InsightErrorState } from 'scenes/insights/EmptyStates'
import { themeLogic } from '~/layout/navigation-3000/themeLogic'
@@ -205,6 +207,11 @@ function getCellTitle(cell: TableDataCell<any>): string | undefined {
return undefined
}
+// Defined at module level so the tooltip's `onOpen` effect doesn't re-run, and re-capture, on every render
+const captureColumnDescriptionViewed = (): void => {
+ posthog.capture('sql column description viewed')
+}
+
// Header labels are clamped to a few lines with a CSS ellipsis when they don't fit. The full text stays
// in the DOM, so we compare the rendered box against the content and reveal the full name on hover only
// when it's actually cut off. The tooltip prefers the explicit label but falls back to the rendered text,
@@ -212,10 +219,14 @@ function getCellTitle(cell: TableDataCell<any>): string | undefined {
function ColumnHeaderTitle({
formattedTitle,
fullTitle,
+ description,
+ truncateTitle,
children,
}: {
formattedTitle: React.ReactNode
fullTitle?: string
+ description?: string
+ truncateTitle?: boolean
children?: React.ReactNode
}): JSX.Element {
const titleRef = useRef<HTMLSpanElement>(null)
@@ -235,12 +246,41 @@ function ColumnHeaderTitle({
}, [detectTruncation])
return (
- <div className="flex items-center gap-1">
+ <div className={cn('flex items-center gap-1', truncateTitle && 'min-w-0')}>
<Tooltip title={tooltip}>
- <span ref={titleRef} onMouseEnter={detectTruncation}>
+ <span
+ ref={titleRef}
+ onMouseEnter={detectTruncation}
+ className={truncateTitle ? 'min-w-0 truncate' : undefined}
+ >
{formattedTitle}
</span>
</Tooltip>
+ {description?.trim() && (
+ <Tooltip
+ title={
+ <div
+ className="ph-no-capture max-h-[min(20rem,calc(100vh-4rem))] overflow-y-auto whitespace-pre-wrap"
+ tabIndex={0}
+ >
+ {description}
+ </div>
+ }
+ openOnClick
+ interactive
+ onOpen={captureColumnDescriptionViewed}
+ >
+ <LemonButton
+ className="ph-no-capture shrink-0"
+ size="xsmall"
+ noPadding
+ icon={<IconInfo />}
+ aria-label={`Description for ${fullTitle ?? 'column'}`}
+ aria-description={description}
+ onClick={(event) => event.stopPropagation()}
+ />
+ </Tooltip>
+ )}
{children}
</div>
)
@@ -347,7 +387,11 @@ export const Table = (props: TableProps): JSX.Element => {
return compareTableCells(sortCells[a.rowIndex], sortCells[b.rowIndex])
},
title: (
- <ColumnHeaderTitle formattedTitle={formattedTitle} fullTitle={fullColumnTitle}>
+ <ColumnHeaderTitle
+ formattedTitle={formattedTitle}
+ fullTitle={fullColumnTitle}
+ description={settings?.display?.description}
+ >
{isPinningEnabled && (
<Tooltip title={isColumnPinned(column.name) ? 'Unpin column' : 'Pin column'}>
<span
@@ -390,10 +434,20 @@ export const Table = (props: TableProps): JSX.Element => {
return (
<div
- className="truncate"
+ className="min-w-0"
title={typeof sourceColumnTitle === 'string' ? sourceColumnTitle : undefined}
>
- {renderedSourceColumnTitle}
+ <ColumnHeaderTitle
+ truncateTitle
+ formattedTitle={renderedSourceColumnTitle}
+ fullTitle={typeof sourceColumnTitle === 'string' ? sourceColumnTitle : undefined}
+ description={
+ cell.sourceColumnName
+ ? sourceTabularColumnsByName.get(cell.sourceColumnName)?.settings?.display
+ ?.description
+ : undefined
+ }
+ />
</div>
)
}
diff --git a/frontend/src/queries/nodes/DataVisualization/Components/ySeriesLogic.ts b/frontend/src/queries/nodes/DataVisualization/Components/ySeriesLogic.ts
index 7b1323d13aa5..edfdfaf61155 100644
--- a/frontend/src/queries/nodes/DataVisualization/Components/ySeriesLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/Components/ySeriesLogic.ts
@@ -1,6 +1,7 @@
import { MakeLogicType, actions, connect, kea, key, path, props, reducers, selectors } from 'kea'
import { forms } from 'kea-forms'
import type { DeepPartial, DeepPartialMap, FieldName, ValidationErrorType } from 'kea-forms'
+import posthog from 'posthog-js'
import { getSeriesColor } from 'lib/colors'
@@ -29,6 +30,7 @@ export interface ySeriesLogicValues {
canOpenSettings: boolean
display: {
color: string
+ description: string
displayType: 'area' | 'auto' | 'bar' | 'line'
excludeFromTotal: boolean
label: string
@@ -41,6 +43,7 @@ export interface ySeriesLogicValues {
displayErrors: DeepPartialMap<
{
color: string
+ description: string
displayType: 'area' | 'auto' | 'bar' | 'line'
excludeFromTotal: boolean
label: string
@@ -57,6 +60,7 @@ export interface ySeriesLogicValues {
displayValidationErrors: DeepPartialMap<
{
color: string
+ description: string
displayType: 'area' | 'auto' | 'bar' | 'line'
excludeFromTotal: boolean
label: string
@@ -118,6 +122,7 @@ export interface ySeriesLogicActions {
} // dataVisualizationLogic
resetDisplay: (values?: {
color: string
+ description: string
displayType: 'area' | 'auto' | 'bar' | 'line'
excludeFromTotal: boolean
label: string
@@ -127,6 +132,7 @@ export interface ySeriesLogicActions {
}) => {
values?: {
color: string
+ description: string
displayType: 'area' | 'auto' | 'bar' | 'line'
excludeFromTotal: boolean
label: string
@@ -161,6 +167,7 @@ export interface ySeriesLogicActions {
setDisplayValues: (
values: DeepPartial<{
color: string
+ description: string
displayType: 'area' | 'auto' | 'bar' | 'line'
excludeFromTotal: boolean
label: string
@@ -171,6 +178,7 @@ export interface ySeriesLogicActions {
) => {
values: DeepPartial<{
color: string
+ description: string
displayType: 'area' | 'auto' | 'bar' | 'line'
excludeFromTotal: boolean
label: string
@@ -222,6 +230,7 @@ export interface ySeriesLogicActions {
}
submitDisplayRequest: (display: {
color: string
+ description: string
displayType: 'area' | 'auto' | 'bar' | 'line'
excludeFromTotal: boolean
label: string
@@ -231,6 +240,7 @@ export interface ySeriesLogicActions {
}) => {
display: {
color: string
+ description: string
displayType: 'area' | 'auto' | 'bar' | 'line'
excludeFromTotal: boolean
label: string
@@ -241,6 +251,7 @@ export interface ySeriesLogicActions {
}
submitDisplaySuccess: (display: {
color: string
+ description: string
displayType: 'area' | 'auto' | 'bar' | 'line'
excludeFromTotal: boolean
label: string
@@ -250,6 +261,7 @@ export interface ySeriesLogicActions {
}) => {
display: {
color: string
+ description: string
displayType: 'area' | 'auto' | 'bar' | 'line'
excludeFromTotal: boolean
label: string
@@ -350,7 +362,7 @@ export const ySeriesLogic = kea<ySeriesLogicType>([
},
],
}),
- forms(({ actions, props }) => ({
+ forms(({ actions, props, values }) => ({
formatting: {
defaults: {
prefix: props.series?.settings?.formatting?.prefix ?? '',
@@ -367,6 +379,14 @@ export const ySeriesLogic = kea<ySeriesLogicType>([
decimalPlaces: Number.isNaN(format.decimalPlaces) ? undefined : format.decimalPlaces,
},
})
+ if (values.formattingChanged) {
+ posthog.capture('sql column settings updated', {
+ settings_tab: 'formatting',
+ query_kind: props.dataVisualizationProps.query.kind,
+ })
+ // Clear the change flag, so reopening and closing without edits is not tracked again
+ actions.resetFormatting(format)
+ }
actions.setSettingsOpen(false)
},
},
@@ -374,6 +394,7 @@ export const ySeriesLogic = kea<ySeriesLogicType>([
defaults: {
color: props.series?.settings?.display?.color ?? getSeriesColor(props.seriesIndex),
label: props.series?.settings?.display?.label ?? '',
+ description: props.series?.settings?.display?.description ?? '',
trendLine: props.series?.settings?.display?.trendLine ?? false,
excludeFromTotal: props.series?.settings?.display?.excludeFromTotal ?? false,
valueLabels: props.series?.settings?.display?.valueLabels ?? 'auto',
@@ -397,6 +418,15 @@ export const ySeriesLogic = kea<ySeriesLogicType>([
displayType: display.displayType,
},
})
+ if (values.displayChanged) {
+ posthog.capture('sql column settings updated', {
+ settings_tab: 'display',
+ query_kind: props.dataVisualizationProps.query.kind,
+ has_description: Boolean(display.description.trim()),
+ })
+ // Clear the change flag, so reopening and closing without edits is not tracked again
+ actions.resetDisplay(display)
+ }
actions.setSettingsOpen(false)
},
},
diff --git a/frontend/src/queries/nodes/DataVisualization/dataVisualizationLogic.ts b/frontend/src/queries/nodes/DataVisualization/dataVisualizationLogic.ts
index da90974c2e00..34bb8be65402 100644
--- a/frontend/src/queries/nodes/DataVisualization/dataVisualizationLogic.ts
+++ b/frontend/src/queries/nodes/DataVisualization/dataVisualizationLogic.ts
@@ -2050,6 +2050,7 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
props.setQuery?.(() => node)
},
setTransposeResults: ({ transpose }) => {
+ posthog.capture('sql table transposed', { transpose, query_kind: values.query.kind })
actions.setQuery((query) => ({
...query,
tableSettings: {
@@ -2086,7 +2087,15 @@ export const dataVisualizationLogic = kea<dataVisualizationLogicType>([
updateSeries: [sharedListeners.axesChanged],
deleteYSeries: [sharedListeners.axesChanged],
updateConditionalFormattingRule: [sharedListeners.conditionalFormattingRules],
- toggleColumnPin: [sharedListeners.pinnedColumnsChanged],
+ toggleColumnPin: [
+ ({ columnName }) => {
+ posthog.capture('sql table column pin toggled', {
+ pinned: values.isColumnPinned(columnName),
+ query_kind: values.query.kind,
+ })
+ },
+ sharedListeners.pinnedColumnsChanged,
+ ],
})),
subscriptions(({ actions, values }) => ({
needsHogVm: (needsHogVm: boolean) => {
diff --git a/frontend/src/queries/schema.json b/frontend/src/queries/schema.json
index 90c4e1bfa1e8..dad46faf8555 100644
--- a/frontend/src/queries/schema.json
+++ b/frontend/src/queries/schema.json
@@ -2822,7 +2822,7 @@
},
"AssistantDataVisualizationColumn": {
"additionalProperties": false,
- "description": "A column with number formatting only. Series display settings apply only to Y-axis series.",
+ "description": "A column with a description and number formatting. Series display settings apply only to Y-axis series.",
"properties": {
"column": {
"description": "Name of a column returned by the SQL query.",
@@ -2830,15 +2830,29 @@
},
"settings": {
"$ref": "#/definitions/AssistantDataVisualizationColumnSettings",
- "description": "Optional number formatting for this column."
+ "description": "Optional display and number-formatting settings for this column."
}
},
"required": ["column"],
"type": "object"
},
+ "AssistantDataVisualizationColumnDisplaySettings": {
+ "additionalProperties": false,
+ "properties": {
+ "description": {
+ "description": "Table column description shown in the header tooltip.",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
"AssistantDataVisualizationColumnSettings": {
"additionalProperties": false,
"properties": {
+ "display": {
+ "$ref": "#/definitions/AssistantDataVisualizationColumnDisplaySettings",
+ "description": "Display settings for this column."
+ },
"formatting": {
"$ref": "#/definitions/AssistantDataVisualizationAxisFormatting",
"description": "Number-formatting settings for the values in this column."
@@ -18253,6 +18267,9 @@
"color": {
"type": "string"
},
+ "description": {
+ "type": "string"
+ },
"displayType": {
"enum": ["auto", "line", "bar", "area"],
"type": "string"
diff --git a/frontend/src/queries/schema/schema-assistant-queries.ts b/frontend/src/queries/schema/schema-assistant-queries.ts
index ca7a5a7bade3..9629bafcf33b 100644
--- a/frontend/src/queries/schema/schema-assistant-queries.ts
+++ b/frontend/src/queries/schema/schema-assistant-queries.ts
@@ -1936,16 +1936,23 @@ export interface AssistantDataVisualizationAxis {
settings?: AssistantDataVisualizationAxisSettings
}
+export interface AssistantDataVisualizationColumnDisplaySettings {
+ /** Table column description shown in the header tooltip. */
+ description?: string
+}
+
export interface AssistantDataVisualizationColumnSettings {
+ /** Display settings for this column. */
+ display?: AssistantDataVisualizationColumnDisplaySettings
/** Number-formatting settings for the values in this column. */
formatting?: AssistantDataVisualizationAxisFormatting
}
-/** A column with number formatting only. Series display settings apply only to Y-axis series. */
+/** A column with a description and number formatting. Series display settings apply only to Y-axis series. */
export interface AssistantDataVisualizationColumn {
/** Name of a column returned by the SQL query. */
column: string
- /** Optional number formatting for this column. */
+ /** Optional display and number-formatting settings for this column. */
settings?: AssistantDataVisualizationColumnSettings
}
diff --git a/frontend/src/queries/schema/schema-general.ts b/frontend/src/queries/schema/schema-general.ts
index 6277fc90852e..843e9598ce57 100644
--- a/frontend/src/queries/schema/schema-general.ts
+++ b/frontend/src/queries/schema/schema-general.ts
@@ -1477,6 +1477,7 @@ export interface ChartSettingsFormatting {
export interface ChartSettingsDisplay {
color?: string
label?: string
+ description?: string
trendLine?: boolean
yAxisPosition?: 'left' | 'right'
displayType?: 'auto' | 'line' | 'bar' | 'area'
diff --git a/posthog/schema.py b/posthog/schema.py
index fb700c04776b..2c2124e01698 100644
--- a/posthog/schema.py
+++ b/posthog/schema.py
@@ -663,10 +663,23 @@ class AssistantDataVisualizationBoxPlotSettings(BaseModel):
)
+class AssistantDataVisualizationColumnDisplaySettings(BaseModel):
+ model_config = ConfigDict(
+ extra="forbid",
+ )
+ description: str | None = Field(
+ default=None,
+ description="Table column description shown in the header tooltip.",
+ )
+
+
class AssistantDataVisualizationColumnSettings(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
+ display: AssistantDataVisualizationColumnDisplaySettings | None = Field(
+ default=None, description="Display settings for this column."
+ )
formatting: AssistantDataVisualizationAxisFormatting | None = Field(
default=None,
description="Number-formatting settings for the values in this column.",
@@ -1227,6 +1240,7 @@ class ChartSettingsDisplay(BaseModel):
extra="forbid",
)
color: str | None = None
+ description: str | None = None
displayType: DisplayType | None = None
excludeFromTotal: bool | None = Field(
default=None,
@@ -3988,7 +4002,8 @@ class AssistantDataVisualizationColumn(BaseModel):
)
column: str = Field(..., description="Name of a column returned by the SQL query.")
settings: AssistantDataVisualizationColumnSettings | None = Field(
- default=None, description="Optional number formatting for this column."
+ default=None,
+ description="Optional display and number-formatting settings for this column.",
)
diff --git a/products/dashboards/frontend/generated/api.schemas.ts b/products/dashboards/frontend/generated/api.schemas.ts
index cf0392ffeb8e..3bf606736dc7 100644
--- a/products/dashboards/frontend/generated/api.schemas.ts
+++ b/products/dashboards/frontend/generated/api.schemas.ts
@@ -9398,6 +9398,7 @@ export const YAxisPositionApi = {
export interface ChartSettingsDisplayApi {
color?: string | null
+ description?: string | null
displayType?: DisplayTypeApi | null
/** Keep this series out of the tooltip's total row, e.g. a target line over stacked bars. */
excludeFromTotal?: boolean | null
diff --git a/products/desktop/packages/api-client/src/generated.ts b/products/desktop/packages/api-client/src/generated.ts
index d76b86c359e3..0c97d6dbfa8b 100644
--- a/products/desktop/packages/api-client/src/generated.ts
+++ b/products/desktop/packages/api-client/src/generated.ts
@@ -4775,6 +4775,7 @@ export namespace Schemas {
export type YAxisPosition = "left" | "right";
export type ChartSettingsDisplay = Partial<{
color: string | null;
+ description: string | null;
displayType: DisplayType | null;
excludeFromTotal: boolean | null;
label: string | null;
diff --git a/products/product_analytics/frontend/generated/api.schemas.ts b/products/product_analytics/frontend/generated/api.schemas.ts
index 0aa073fca99f..01bb49ae5a3d 100644
--- a/products/product_analytics/frontend/generated/api.schemas.ts
+++ b/products/product_analytics/frontend/generated/api.schemas.ts
@@ -8204,6 +8204,7 @@ export const YAxisPositionApi = {
export interface ChartSettingsDisplayApi {
color?: string | null
+ description?: string | null
displayType?: DisplayTypeApi | null
/** Keep this series out of the tooltip's total row, e.g. a target line over stacked bars. */
excludeFromTotal?: boolean | null
diff --git a/services/mcp/src/api/generated.ts b/services/mcp/src/api/generated.ts
index 1a888824926b..5f4f32b28e0e 100644
--- a/services/mcp/src/api/generated.ts
+++ b/services/mcp/src/api/generated.ts
@@ -11013,6 +11013,7 @@ export namespace Schemas {
export interface ChartSettingsDisplay {
color?: string | null;
+ description?: string | null;
displayType?: DisplayType | null;
/** Keep this series out of the tooltip's total row, e.g. a target line over stacked bars. */
excludeFromTotal?: boolean | null;
diff --git a/services/mcp/src/tools/generated/product_analytics.ts b/services/mcp/src/tools/generated/product_analytics.ts
index c1a423cc7cdd..a1724e5ce5c7 100644
--- a/services/mcp/src/tools/generated/product_analytics.ts
+++ b/services/mcp/src/tools/generated/product_analytics.ts
@@ -125,6 +125,10 @@ const PieChartSettings = z.object({
.optional(),
})
+const AssistantDataVisualizationColumnDisplaySettings = z.object({
+ description: z.string().describe('Table column description shown in the header tooltip.').optional(),
+})
+
const AssistantDataVisualizationAxisFormatting = z.object({
decimalPlaces: z.coerce.number().describe('Number of decimal places to display.').optional(),
prefix: z.string().describe('Text prepended to each value (e.g. `$`).').optional(),
@@ -138,6 +142,7 @@ const AssistantDataVisualizationAxisFormatting = z.object({
})
const AssistantDataVisualizationColumnSettings = z.object({
+ display: AssistantDataVisualizationColumnDisplaySettings.describe('Display settings for this column.').optional(),
formatting: AssistantDataVisualizationAxisFormatting.describe(
'Number-formatting settings for the values in this column.'
).optional(),
@@ -146,7 +151,7 @@ const AssistantDataVisualizationColumnSettings = z.object({
const AssistantDataVisualizationColumn = z.object({
column: z.string().describe('Name of a column returned by the SQL query.'),
settings: AssistantDataVisualizationColumnSettings.describe(
- 'Optional number formatting for this column.'
+ 'Optional display and number-formatting settings for this column.'
).optional(),
})
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-create.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-create.json
index f96b287dad55..f4e0a4f6e767 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-create.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-create.json
@@ -355,8 +355,18 @@
"type": "string"
},
"settings": {
- "description": "Optional number formatting for this column.",
+ "description": "Optional display and number-formatting settings for this column.",
"properties": {
+ "display": {
+ "description": "Display settings for this column.",
+ "properties": {
+ "description": {
+ "description": "Table column description shown in the header tooltip.",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
"formatting": {
"description": "Number-formatting settings for the values in this column.",
"properties": {
@@ -519,8 +529,18 @@
"type": "string"
},
"settings": {
- "description": "Optional number formatting for this column.",
+ "description": "Optional display and number-formatting settings for this column.",
"properties": {
+ "display": {
+ "description": "Display settings for this column.",
+ "properties": {
+ "description": {
+ "description": "Table column description shown in the header tooltip.",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
"formatting": {
"description": "Number-formatting settings for the values in this column.",
"properties": {
diff --git a/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-update.json b/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-update.json
index 8b5384cdb030..e382046b0cfa 100644
--- a/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-update.json
+++ b/services/mcp/tests/unit/__snapshots__/tool-schemas/insight-update.json
@@ -366,8 +366,18 @@
"type": "string"
},
"settings": {
- "description": "Optional number formatting for this column.",
+ "description": "Optional display and number-formatting settings for this column.",
"properties": {
+ "display": {
+ "description": "Display settings for this column.",
+ "properties": {
+ "description": {
+ "description": "Table column description shown in the header tooltip.",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
"formatting": {
"description": "Number-formatting settings for the values in this column.",
"properties": {
@@ -530,8 +540,18 @@
"type": "string"
},
"settings": {
- "description": "Optional number formatting for this column.",
+ "description": "Optional display and number-formatting settings for this column.",
"properties": {
+ "display": {
+ "description": "Display settings for this column.",
+ "properties": {
+ "description": {
+ "description": "Table column description shown in the header tooltip.",
+ "type": "string"
+ }
+ },
+ "type": "object"
+ },
"formatting": {
"description": "Number-formatting settings for the values in this column.",
"properties": {
diff --git a/services/mcp/tests/unit/insight-query-shapes.test.ts b/services/mcp/tests/unit/insight-query-shapes.test.ts
index a64dee5d2fcf..6e6c43112f83 100644
--- a/services/mcp/tests/unit/insight-query-shapes.test.ts
+++ b/services/mcp/tests/unit/insight-query-shapes.test.ts
@@ -19,7 +19,13 @@ const acceptedQueries = [
},
{
shape: 'wrapped DataVisualizationNode',
- query: { kind: 'DataVisualizationNode', source: { kind: 'HogQLQuery', query: 'select 1' } },
+ query: {
+ kind: 'DataVisualizationNode',
+ source: { kind: 'HogQLQuery', query: 'select 1 as value' },
+ tableSettings: {
+ columns: [{ column: 'value', settings: { display: { description: 'Value in USD' } } }],
+ },
+ },
},
{
shape: 'BI worksheet',