gkneighb opened a new pull request, #43572:
URL: https://github.com/apache/superset/pull/43572
### SUMMARY
Adds a `generate_chart` MCP plugin for the **bubble** chart type (`viz_type:
bubble_v2`), so the MCP `generate_chart` tool can produce bubble charts. Bubble
is a shipped Superset viz type that had no MCP plugin; this closes that gap.
The plugin mirrors the frontend Bubble `buildQuery` contract: an `entity`
dimension identifies each bubble, three separate metrics position and size it
(`x` horizontal, `y` vertical, `size` area), and an optional `series` dimension
colours the bubbles by group.
Follows the established plugin pattern
(`pie`/`funnel`/`gauge`/`treemap`/`heatmap`/`radar`/`waterfall`) — a config
schema, a `map_*_config` mapper, a plugin class, and registration:
- **`BubbleChartConfig`** — `entity`, `x`, `y`, and `size` required;
optional `series`, `row_limit` (default 10000), `filters`, `color_scheme`.
Added to the `ChartConfig` discriminated union and the `get_chart_type_schema`
adapters. `x`/`y`/`size` are **three separate metric keys** (the query layer
aliases them into `metrics`), not a metrics array; `entity`/`series` may not be
`saved_metric`/`sql_expression` (dimensions, not metrics).
- **`map_bubble_config`** — maps the config to `form_data`; saved metrics
pass through as bare name strings, ad-hoc metrics as SIMPLE/SQL adhoc objects.
`series` is omitted from `form_data` when unset.
- **`BubbleChartPlugin`** — registered in the plugin registry. Only the
legacy `bubble` key was in the recommendation category map, so this adds
`bubble_v2` → `bubble`.
The field set is intentionally minimal (core query contract). Cosmetic
controls (max bubble size, axis labels/formats/bounds, log scales, opacity) are
left for a follow-up.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — backend/MCP only, no UI change.
### TESTING INSTRUCTIONS
`pytest tests/unit_tests/mcp_service/chart/test_bubble_chart.py` — 20 unit
tests cover schema validation (four required fields, `entity`/`series`
not-a-metric, saved-metric axis accepted, extra-field rejection), `ChartConfig`
union dispatch, `form_data` mapping (three separate metric keys, `series`
omitted when unset, saved-metric passthrough), and registry integration
(registration, `resolve_viz_type`, `display_name`, `pre_validate`,
recommendation category).
To exercise end-to-end: call the `generate_chart` MCP tool with
`{"chart_type": "bubble_v2", "entity": {"name": "country"}, "x": {"name":
"gdp", "aggregate": "AVG"}, "y": {"name": "life_expectancy", "aggregate":
"AVG"}, "size": {"name": "population", "aggregate": "SUM"}}`.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]