Bug: preserve visualization settings when MCP updates an insight's SQL
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 39.9k
- Forks
- 3.4k
- Avg merge
- 6h 51m
- Merged PRs (30d)
- 232
Description
Bug description
When an MCP client (for example Claude via the PostHog MCP server) updates a saved SQL insight by passing a new query, the insight's visualization settings are reset. Tiles that were configured as Big Number or bar charts revert to the default table view after the update, even though only the HogQL was changed.
The MCP insight-update tool schema now exposes display, chartSettings, and tableSettings (added in #54033), so a client can in principle pass them back.
The expected behaviour is that a partial update that only changes the HogQL source should preserve existing display, chartSettings, and tableSettings unless the client explicitly sends new values.
How to reproduce
- Create a SQL insight and set its visualization to Big Number (or a non-default chart type).
- From an MCP client, call
insight-updateon that insight with a modifiedquerythat only setskindandsource(nodisplay,chartSettings, ortableSettings). - Open the insight in the UI: the visualization has reverted to a plain table.
Additional context
https://posthoghelp.zendesk.com/agent/tickets/54542 (moved to PostHog: https://us.posthog.com/project/2/support/tickets/56980)
Debug info
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the MCP insight-update tool and its handling of the query source; inspect how omitted display, chartSettings, and tableSettings values are applied during a partial update. Reproduce the update on an insight with a non-default visualization, then verify that changing only the HogQL leaves those settings unchanged while explicitly supplied values still update them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 68/100