From a2b0f6417682fa0366378f6c5f56db4e782678a3 Mon Sep 17 00:00:00 2001 From: Amin Ghadersohi Date: Thu, 7 May 2026 16:18:26 +0000 Subject: [PATCH] fix(mcp): use valid opr value in docstring filter examples; fix dashboard docstring test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Replace opr:"ct" with opr:"sw" in filter examples in list_datasets, list_charts, and list_dashboards docstrings — "ct" is not a valid ColumnOperatorEnum value, so examples using it produce validation errors - Fix TestDashboardSortableColumns.test_sortable_columns_in_docstring: assertion checked for "Sortable columns for order_column:" (plain text) but docstring uses RST backtick format; split into two substring checks matching "Sortable columns for" and "order_column" separately --- superset/mcp_service/chart/tool/list_charts.py | 2 +- superset/mcp_service/dashboard/tool/list_dashboards.py | 2 +- superset/mcp_service/dataset/tool/list_datasets.py | 2 +- .../mcp_service/dashboard/tool/test_dashboard_tools.py | 3 ++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/superset/mcp_service/chart/tool/list_charts.py b/superset/mcp_service/chart/tool/list_charts.py index 66c6909f33f..bfb2c564540 100644 --- a/superset/mcp_service/chart/tool/list_charts.py +++ b/superset/mcp_service/chart/tool/list_charts.py @@ -97,7 +97,7 @@ async def list_charts( # Correct usage list_charts(request={"search": "revenue", "page": 1, "page_size": 10}) - list_charts(request={"filters": [{"col": "slice_name", "opr": "ct", "value": "sales"}]}) + list_charts(request={"filters": [{"col": "slice_name", "opr": "sw", "value": "sales"}]}) list_charts() # no arguments returns first page with defaults # Wrong — causes pydantic validation errors diff --git a/superset/mcp_service/dashboard/tool/list_dashboards.py b/superset/mcp_service/dashboard/tool/list_dashboards.py index ed856dff47d..8c479df2753 100644 --- a/superset/mcp_service/dashboard/tool/list_dashboards.py +++ b/superset/mcp_service/dashboard/tool/list_dashboards.py @@ -91,7 +91,7 @@ async def list_dashboards( # Correct usage list_dashboards(request={"search": "sales", "page": 1, "page_size": 10}) - list_dashboards(request={"filters": [{"col": "dashboard_title", "opr": "ct", "value": "exec"}]}) + list_dashboards(request={"filters": [{"col": "dashboard_title", "opr": "sw", "value": "exec"}]}) list_dashboards() # no arguments returns first page with defaults # Wrong — causes pydantic validation errors diff --git a/superset/mcp_service/dataset/tool/list_datasets.py b/superset/mcp_service/dataset/tool/list_datasets.py index 9679f658316..099c15231ea 100644 --- a/superset/mcp_service/dataset/tool/list_datasets.py +++ b/superset/mcp_service/dataset/tool/list_datasets.py @@ -102,7 +102,7 @@ async def list_datasets( # Correct usage list_datasets(request={"search": "sales", "page": 1, "page_size": 10}) - list_datasets(request={"filters": [{"col": "table_name", "opr": "ct", "value": "orders"}]}) + list_datasets(request={"filters": [{"col": "table_name", "opr": "sw", "value": "orders"}]}) list_datasets() # no arguments returns first page with defaults # Wrong — causes pydantic validation errors diff --git a/tests/unit_tests/mcp_service/dashboard/tool/test_dashboard_tools.py b/tests/unit_tests/mcp_service/dashboard/tool/test_dashboard_tools.py index 64d31eb76e1..a2b4e1e5f98 100644 --- a/tests/unit_tests/mcp_service/dashboard/tool/test_dashboard_tools.py +++ b/tests/unit_tests/mcp_service/dashboard/tool/test_dashboard_tools.py @@ -1349,7 +1349,8 @@ class TestDashboardSortableColumns: # Check list_dashboards docstring for sortable columns documentation assert list_dashboards.__doc__ is not None - assert "Sortable columns for order_column:" in list_dashboards.__doc__ + assert "Sortable columns for" in list_dashboards.__doc__ + assert "order_column" in list_dashboards.__doc__ for col in SORTABLE_DASHBOARD_COLUMNS: assert col in list_dashboards.__doc__