docs(mcp): document all 7 generate_chart chart_type values, fix stale config comment#41599
Draft
aminghadersohi wants to merge 2 commits into
Draft
Conversation
The generate_chart tool's docstring only described chart_type='xy' and 'table', even though the schema has supported 'pie', 'pivot_table', 'mixed_timeseries', 'handlebars', and 'big_number' since apache#38375/apache#38402/apache#38403. LLM clients calling chart_type='line' or 'bar' (a 'kind' value, not a chart_type) hit the raw Pydantic discriminator error and looped through retries until timeout. Lists all 7 valid chart_type values with their required fields, adds a natural-language lookup table, and adds a pie chart example.
MCP_TOOL_SEARCH_CONFIG has defaulted include_schemas to True since apache#39732 (to keep discriminated-union chart configs visible to LLMs without a second round trip), but the comment above it still described include_schemas=False as the default.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #41599 +/- ##
==========================================
- Coverage 64.42% 64.42% -0.01%
==========================================
Files 2668 2668
Lines 147182 147182
Branches 33947 33947
==========================================
- Hits 94821 94816 -5
- Misses 50646 50649 +3
- Partials 1715 1717 +2
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's docstring only documentedchart_type='xy'andchart_type='table', even though the underlying schema (ChartConfigdiscriminated union) has supported 5 additional chart types since #38375, #38402, and #38403:pie,pivot_table,mixed_timeseries,handlebars, andbig_number.Because the docstring is the primary signal an LLM client sees before calling the tool, models reaching for natural chart-type names like
'line','bar', or'pie'directly as thechart_typevalue (instead of as akindsub-field ofchart_type='xy', or simply being unaware'pie'was a valid discriminator at all) would hit the raw Pydantic discriminator validation error and loop through retries until timing out.This PR only touches docstrings/comments — no schema, validation, or behavior changes:
generate_chartdocstring now lists all 7 validchart_typevalues with their required fieldskind(line/bar/area/scatter) is a sub-field ofchart_type='xy', not a chart_type itselfMCP_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 chart configs visible to LLMs without a second round trip)BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A — docstring/comment-only change, not user-facing UI.
TESTING INSTRUCTIONS
ruff format --check/ruff checkpass on both changed filestests/unit_tests/mcp_service/chart/tool/test_generate_chart.pysuite is unaffected since only documentation (not schema or logic) changedADDITIONAL INFORMATION