aminghadersohi opened a new pull request, #38375:
URL: https://github.com/apache/superset/pull/38375
### SUMMARY
Add three new chart types to the MCP service chart creation pipeline,
expanding the set of charts that can be programmatically created via the Model
Context Protocol:
- **Pie/Donut charts** (`chart_type="pie"`): Category-based proportional
visualization with configurable labels, donut mode, slice limits, and number
formatting
- **Pivot Table V2** (`chart_type="pivot_table"`): Interactive
cross-tabulation with row/column grouping, multiple aggregation functions,
totals, and value formatting
- **Mixed Timeseries** (`chart_type="mixed_timeseries"`): Dual-series charts
combining two chart types (e.g., line + bar) on the same time axis with
independent Y-axes and groupby support
Previously, only XY charts (line, bar, area, scatter) and tables could be
created via MCP. These three chart types were viewable but not creatable,
requiring users to fall back to the Superset UI.
Key changes:
- New Pydantic schemas: `PieChartConfig`, `PivotTableChartConfig`,
`MixedTimeseriesChartConfig` with full field validation
- New form_data mapping functions: `map_pie_config`,
`map_pivot_table_config`, `map_mixed_timeseries_config`
- Updated `ChartConfig` discriminated union to include new types
- Updated `SchemaValidator` with pre-validation for all new chart types
- Updated MCP instructions to list new creatable chart types
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A - Backend-only changes to MCP service
### TESTING INSTRUCTIONS
1. Run the new unit tests:
```bash
pytest tests/unit_tests/mcp_service/chart/test_new_chart_types.py -v
```
Expected: 58 tests pass
2. Run the full MCP test suite to verify no regressions:
```bash
pytest tests/unit_tests/mcp_service/ -x -q
```
Expected: All tests pass
3. Test chart creation via MCP client:
- Create a pie chart: `generate_chart(dataset_id=X, config={"chart_type":
"pie", "dimension": {"name": "category"}, "metric": {"name": "revenue",
"aggregate": "SUM"}})`
- Create a pivot table: `generate_chart(dataset_id=X,
config={"chart_type": "pivot_table", "rows": [{"name": "product"}], "metrics":
[{"name": "sales", "aggregate": "SUM"}]})`
- Create a mixed timeseries: `generate_chart(dataset_id=X,
config={"chart_type": "mixed_timeseries", "x": {"name": "date"}, "y": [{"name":
"revenue", "aggregate": "SUM"}], "y_secondary": [{"name": "orders",
"aggregate": "COUNT"}]})`
### ADDITIONAL INFORMATION
- [x] Introduces new feature or API
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration
- [ ] Removes existing feature or API
--
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]