fix(mcp): document all 7 generate_chart chart_type values#41598
Draft
aminghadersohi wants to merge 1 commit into
Draft
fix(mcp): document all 7 generate_chart chart_type values#41598aminghadersohi wants to merge 1 commit into
aminghadersohi wants to merge 1 commit into
Conversation
…config comment generate_chart's docstring only documented chart_type='xy'/'table', so LLM clients calling with viz_type-style values like 'line', 'bar', or 'pie' as chart_type hit raw Pydantic discriminator errors and looped through search_tools/retries until timing out. Document all 7 valid chart_type values (xy, table, pie, pivot_table, mixed_timeseries, handlebars, big_number) with required fields, a natural-language quick-lookup table, and a pie chart example. Also corrects a stale comment in MCP_TOOL_SEARCH_CONFIG that described include_schemas=False as the default; it has defaulted to True since apache#39732 to keep discriminated-union chart configs visible to LLMs.
✅ Deploy Preview for superset-docs-preview ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41598 +/- ##
==========================================
- Coverage 64.35% 64.09% -0.27%
==========================================
Files 2651 2659 +8
Lines 144804 146473 +1669
Branches 33413 33660 +247
==========================================
+ Hits 93192 93879 +687
- Misses 49944 50877 +933
- Partials 1668 1717 +49
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
SUMMARY
The
generate_chartMCP tool docstring only documentedchart_type='xy'andchart_type='table', even though the underlyingChartConfigdiscriminated union has supported 7 chart types (xy,table,pie,pivot_table,mixed_timeseries,handlebars,big_number) since #38375/#38402/#38403. LLM clients calling the tool with intuitive-but-wrong values (e.g.chart_type='line',chart_type='bar',chart_type='pie'without realizing it neededdimension/metric) hit raw Pydantic discriminator errors and looped through retries/search_toolsuntil timing out.This PR:
chart_typediscriminator values directly in the tool docstring, with required fields for each.chart_type(+kindfor XY charts), clarifying thatline/bar/area/scatterarekindvalues withinchart_type='xy', notchart_typevalues themselves.chart_type='pie'.MCP_TOOL_SEARCH_CONFIGthat describedinclude_schemas=Falseas the default; it has defaulted toTruesince fix(mcp): restore typed ChartConfig in tool schemas for LLM visibility #39732 (to keep discriminated-union configs visible to LLMs insearch_toolsresults), but the comment still said otherwise.No behavior change — docstring/comment only.
TESTING INSTRUCTIONS
python -m py_compile superset/mcp_service/chart/tool/generate_chart.py superset/mcp_service/mcp_config.pytests/unit_tests/mcp_service/chart/tool/test_generate_chart.pycontinue to pass (no behavior touched).get_chart_type_schema/search_toolsoutput forgenerate_chart.ADDITIONAL INFORMATION