aminghadersohi commented on code in PR #40473:
URL: https://github.com/apache/superset/pull/40473#discussion_r3329456112
##########
superset/mcp_service/chart/tool/get_chart_info.py:
##########
@@ -213,7 +214,7 @@ def _apply_unsaved_state_override(result: ChartInfo,
form_data_key: str) -> None
)
async def get_chart_info(
request: GetChartInfoRequest, ctx: Context
-) -> ChartInfo | ChartError:
+) -> dict[str, Any] | ChartError:
"""Get chart metadata by ID or UUID.
Review Comment:
Fixed in 3c917c7f99 (previous commit): the unsaved-chart path now calls
`result.model_dump(mode='json', context={'select_columns':
request.select_columns})` — same pattern as the saved-chart path. Also covered
by the new `test_unsaved_chart_select_columns_filters_response` test.
##########
superset/mcp_service/chart/tool/get_chart_info.py:
##########
@@ -213,7 +214,7 @@ def _apply_unsaved_state_override(result: ChartInfo,
form_data_key: str) -> None
)
async def get_chart_info(
request: GetChartInfoRequest, ctx: Context
-) -> ChartInfo | ChartError:
+) -> dict[str, Any] | ChartError:
Review Comment:
Fixed in 3c917c7f99 (previous commit): the unsaved-chart path now calls
`result.model_dump(mode='json', context={'select_columns':
request.select_columns})` — same pattern as the saved-chart path. Also covered
by the new `test_unsaved_chart_select_columns_filters_response` test.
##########
superset/mcp_service/chart/tool/get_chart_info.py:
##########
@@ -213,7 +214,7 @@ def _apply_unsaved_state_override(result: ChartInfo,
form_data_key: str) -> None
)
async def get_chart_info(
request: GetChartInfoRequest, ctx: Context
-) -> ChartInfo | ChartError:
+) -> dict[str, Any] | ChartError:
Review Comment:
Fixed in 3c917c7f99 (previous commit): the unsaved-chart path now calls
`result.model_dump(mode='json', context={'select_columns':
request.select_columns})` — same pattern as the saved-chart path. Also covered
by the new `test_unsaved_chart_select_columns_filters_response` test.
##########
superset/mcp_service/dashboard/schemas.py:
##########
@@ -312,6 +339,29 @@ class GetDashboardInfoRequest(MetadataCacheControl):
"from that permalink."
),
)
+ select_columns: Annotated[
+ List[str],
+ Field(
+ default_factory=lambda: list(DEFAULT_GET_DASHBOARD_INFO_COLUMNS),
+ description=(
+ "Top-level fields to include in the response. Defaults to a
lean "
+ "set that excludes 'css' (raw CSS, can be many KB) and
'filter_state' "
+ "(only relevant when permalink_key is provided). Pass an
explicit list "
+ "to override, e.g. ['id','dashboard_title','charts'] for
minimal "
+ "output, or add 'css' to include raw dashboard CSS."
+ ),
+ ),
+ ]
+
+ @field_validator("select_columns", mode="before")
+ @classmethod
+ def _parse_select_columns(cls, value: Any) -> Any:
+ from superset.mcp_service.utils.schema_utils import parse_json_or_list
+
+ if value is None:
+ return list(DEFAULT_GET_DASHBOARD_INFO_COLUMNS)
+ result = parse_json_or_list(value, "select_columns")
+ return result or list(DEFAULT_GET_DASHBOARD_INFO_COLUMNS)
Review Comment:
Fixed in commit be1a407188: `filter_state` was removed from
`DEFAULT_GET_DASHBOARD_INFO_COLUMNS` in a previous commit (3c917c7f99). The
current HEAD at line 291–314 confirms the default list does not include
`filter_state`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]