diff --git a/superset/mcp_service/chart/plugins/big_number.py b/superset/mcp_service/chart/plugins/big_number.py index 93c3ace6c98..4be98e1c58b 100644 --- a/superset/mcp_service/chart/plugins/big_number.py +++ b/superset/mcp_service/chart/plugins/big_number.py @@ -71,8 +71,7 @@ class BigNumberChartPlugin(BaseChartPlugin): error_type="invalid_metric_type", message="Big Number metric must be a dict with 'name' and 'aggregate'", details=( - "The 'metric' field must be an object, got " - f"{type(metric).__name__}" + f"The 'metric' field must be an object, got {type(metric).__name__}" ), suggestions=[ "Use a dict: {'name': 'col', 'aggregate': 'SUM'}", diff --git a/superset/mcp_service/chart/plugins/handlebars.py b/superset/mcp_service/chart/plugins/handlebars.py index 68e5a8096c5..85c7cc1511b 100644 --- a/superset/mcp_service/chart/plugins/handlebars.py +++ b/superset/mcp_service/chart/plugins/handlebars.py @@ -73,8 +73,7 @@ class HandlebarsChartPlugin(BaseChartPlugin): ), suggestions=[ "Ensure handlebars_template is a non-empty string", - "Example: ''", + "Example: ''", ], error_code="INVALID_HANDLEBARS_TEMPLATE", ) diff --git a/superset/mcp_service/chart/validation/schema_validator.py b/superset/mcp_service/chart/validation/schema_validator.py index 980c2b56f3a..eb404d11f19 100644 --- a/superset/mcp_service/chart/validation/schema_validator.py +++ b/superset/mcp_service/chart/validation/schema_validator.py @@ -199,7 +199,8 @@ class SchemaValidator: "details": "The XY chart configuration is missing required " "fields or has invalid structure", "suggestions": [ - "Note: 'x' is optional and defaults to the dataset's primary datetime column", + "Note: 'x' is optional and defaults to the dataset's primary " + "datetime column", "Ensure 'y' is an array: [{'name': 'metric', 'aggregate': 'SUM'}]", "Check that all column names are strings", "Verify aggregate functions are valid: SUM, COUNT, AVG, MIN, MAX", diff --git a/tests/unit_tests/mcp_service/chart/tool/test_get_chart_data.py b/tests/unit_tests/mcp_service/chart/tool/test_get_chart_data.py index c1e347af55c..5404f8985b6 100644 --- a/tests/unit_tests/mcp_service/chart/tool/test_get_chart_data.py +++ b/tests/unit_tests/mcp_service/chart/tool/test_get_chart_data.py @@ -222,9 +222,9 @@ class TestBigNumberChartFallback: "viz_type": viz_type, } metrics, _ = _extract_metrics_and_groupby(form_data) - assert metrics == [ - {"label": "plural_metric"} - ], f"{viz_type} should use plural metrics" + assert metrics == [{"label": "plural_metric"}], ( + f"{viz_type} should use plural metrics" + ) def test_pop_kpi_uses_singular_metric(self): """Test that pop_kpi (BigNumberPeriodOverPeriod) uses singular metric."""