Compare commits

...

1 Commits

Author SHA1 Message Date
Richard Fogaça
bb5bd03598 fix(mcp): preserve compact chart config schema guidance 2026-04-24 11:08:33 -03:00
2 changed files with 15 additions and 0 deletions

View File

@@ -1271,6 +1271,10 @@ _CHART_CONFIG_DESCRIPTION = (
"'pivot_table' (rows, metrics), 'mixed_timeseries' (x, y, y_secondary), "
"'handlebars' (columns, handlebars_template), "
"'big_number' (metric). "
"Do not use Superset Explore form-data fields like 'viz_type' or "
"'time_range', and do not use Superset viz type names like "
"'echarts_timeseries_bar' as chart_type. For bar charts use "
"{'chart_type': 'xy', 'kind': 'bar', ...}. "
"See chart://configs resource for full field reference and examples."
)

View File

@@ -23,6 +23,7 @@ import pytest
from pydantic import ValidationError
from superset.mcp_service.chart.schemas import (
_CHART_CONFIG_DESCRIPTION,
ColumnRef,
GenerateChartRequest,
parse_chart_config,
@@ -31,6 +32,16 @@ from superset.mcp_service.chart.schemas import (
)
def test_chart_config_description_warns_against_form_data_fields() -> None:
"""Compact tool schema points LLMs to the MCP chart config dialect."""
assert "'chart_type': 'xy'" in _CHART_CONFIG_DESCRIPTION
assert "'kind': 'bar'" in _CHART_CONFIG_DESCRIPTION
assert "Superset Explore form-data" in _CHART_CONFIG_DESCRIPTION
assert "viz_type" in _CHART_CONFIG_DESCRIPTION
assert "time_range" in _CHART_CONFIG_DESCRIPTION
assert "echarts_timeseries_bar" in _CHART_CONFIG_DESCRIPTION
class TestTableChartConfig:
"""Test TableChartConfig validation."""