Skip to content

feat(mcp): Chart formatting options#39887

Draft
msyavuz wants to merge 1 commit intomasterfrom
feat/mcp-chart-color-scheme
Draft

feat(mcp): Chart formatting options#39887
msyavuz wants to merge 1 commit intomasterfrom
feat/mcp-chart-color-scheme

Conversation

@msyavuz
Copy link
Copy Markdown
Member

@msyavuz msyavuz commented May 5, 2026

SUMMARY

Adds an optional color_scheme field to the MCP XYChartConfig and PieChartConfig so LLM clients can pick a Superset color palette when generating charts. Pie's hardcoded
"supersetColors" is now an overridable default; XY had no color control before. Wired through map_xy_config (via a new add_color_scheme helper to keep it under the C901 complexity
limit) and map_pie_config.

Example:

{
  "dataset_id": 1,
  "config": {
    "chart_type": "xy",
    "x": {"name": "ds"}, "y": [{"name": "val", "aggregate": "SUM"}],
    "kind": "line",
    "color_scheme": "lyftColors"
  }
}

This is a minimal first slice of broader MCP chart-formatting work (number/date format, axis/data labels, dashboard-level metric color overrides) — those will follow in separate PRs.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

  1. pytest tests/unit_tests/mcp_service/chart/test_chart_utils.py::TestMapXYConfig tests/unit_tests/mcp_service/chart/test_new_chart_types.py::TestMapPieConfig (3 new tests + existing 24
    pass).
  2. Via MCP generate_chart: pass "color_scheme": "lyftColors" in an XY or Pie config and confirm it lands in form_data.color_scheme; omit it on XY and confirm the key is absent (Superset
    default applies).

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link
Copy Markdown

codecov Bot commented May 5, 2026

Codecov Report

❌ Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.36%. Comparing base (d618837) to head (0b97cc5).

Files with missing lines Patch % Lines
superset/mcp_service/chart/chart_utils.py 25.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #39887      +/-   ##
==========================================
- Coverage   64.36%   64.36%   -0.01%     
==========================================
  Files        2569     2569              
  Lines      134745   134751       +6     
  Branches    31278    31279       +1     
==========================================
+ Hits        86731    86734       +3     
- Misses      46516    46519       +3     
  Partials     1498     1498              
Flag Coverage Δ
hive 39.67% <50.00%> (+<0.01%) ⬆️
mysql 59.93% <50.00%> (-0.01%) ⬇️
postgres 60.02% <50.00%> (-0.01%) ⬇️
presto 41.42% <50.00%> (+<0.01%) ⬆️
python 61.55% <50.00%> (-0.01%) ⬇️
sqlite 59.64% <50.00%> (-0.01%) ⬇️
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant