-
Notifications
You must be signed in to change notification settings - Fork 16.5k
feat(mcp): add time_grain parameter to XY chart generation #37182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
feat(mcp): add time_grain parameter to XY chart generation #37182
Conversation
Adds a `time_grain` parameter to XYChartConfig that allows LLM clients to specify temporal granularity (second, minute, hour, day, week, month, quarter, year) when creating time-series charts via the MCP service. This fixes an issue where charts with temporal x-axis columns would aggregate all data together instead of grouping by the desired time period (e.g., monthly breakdown). Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Code Review Agent Run #d257c0Actionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
CodeAnt AI finished reviewing your PR. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #37182 +/- ##
===========================================
+ Coverage 0 67.83% +67.83%
===========================================
Files 0 642 +642
Lines 0 48088 +48088
Branches 0 5262 +5262
===========================================
+ Hits 0 32622 +32622
- Misses 0 14179 +14179
- Partials 0 1287 +1287
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Based on the PR diff, the time_grain field and its type are newly added to the XYChartConfig class in schemas.py. The changes don't show this type defined elsewhere in the modified files. |
Addresses review feedback to reuse the existing TimeGrain StrEnum from superset/constants.py instead of defining an inline Literal type. Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
CodeAnt AI is running Incremental review Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
|
Thanks for the feedback @mistercrunch! I've updated the PR to use Changes:
All tests pass and pre-commit checks are green. |
|
CodeAnt AI Incremental review completed. |
Code Review Agent Run #71ee3eActionable Suggestions - 0Review Details
Bito Usage GuideCommands Type the following command in the pull request comment and save the comment.
Refer to the documentation for additional commands. Configuration This repository uses Documentation & Help |
Summary
Adds a
time_grainparameter toXYChartConfigthat allows LLM clients to specify temporal granularity when creating time-series charts via the MCP service.Changes:
time_grainfield toXYChartConfigschema with support for common granularities (second, minute, hour, day, week, month, quarter, year)map_xy_config()to includetime_grain_sqlain form_data when specifiedProblem
When creating time-series charts through the MCP generate_chart tool, charts with temporal x-axis columns would aggregate all data together instead of grouping by the desired time period. This made it impossible for LLM clients to create charts showing monthly/weekly/daily breakdowns.
Solution
Added an optional
time_grainparameter that maps to Superset'stime_grain_sqlaform_data field, allowing proper temporal grouping.Example usage:
BEFORE/AFTER
BEFORE: Time-series charts aggregated all data into a single point
AFTER: Time-series charts can show data grouped by the specified time grain (day, week, month, etc.)
TESTING INSTRUCTIONS
time_grainparameterADDITIONAL INFORMATION
🤖 Generated with Claude Code