aminghadersohi opened a new pull request, #40473:
URL: https://github.com/apache/superset/pull/40473

   ## Summary
   
   The three `*_info` tools (`get_dashboard_info`, `get_chart_info`, 
`get_dataset_info`) could return responses exceeding 91KB for large resources, 
causing `ResponseSizeGuardMiddleware` to truncate responses into an unusable 
state for MCP clients.
   
   Root cause: `DashboardInfo`, `ChartInfo`, and `DatasetInfo` already have 
`_filter_fields_by_context` model serializers that support context-based field 
filtering, but none of their request schemas exposed a `select_columns` 
parameter — so the filtering was never invoked.
   
   ### Changes
   
   - **`get_dashboard_info`**: adds `select_columns` to 
`GetDashboardInfoRequest` with a lean default that excludes `css` (raw CSS, can 
be many KB) and `filter_state` (only relevant with `permalink_key`).
   
   - **`get_chart_info`**: adds `select_columns` to `GetChartInfoRequest` with 
a lean default that excludes `form_data` (full chart config dict, can be 
50KB+). Callers that need the raw config can add `'form_data'` explicitly.
   
   - **`get_dataset_info`**: adds `select_columns` (lean top-level field set) 
and `column_fields` (per-column field set, defaults to 
`column_name/type/is_dttm`) to `GetDatasetInfoRequest`. Adds 
`_filter_column_fields_by_context` to `TableColumnInfo` so per-column filtering 
applies during serialization.
   
   All three tools now call `result.model_dump(context={"select_columns": 
...})` so filtering fires on every call. Default response size for a large 
dashboard drops from ~91KB to a few KB. Callers can opt in to wider responses 
by passing explicit `select_columns` lists.
   
   ## Testing
   
   - Existing tests for all three tools continue to pass
   - Default response for large dashboards stays within the MCP token limit
   - Explicit `select_columns` override returns only the requested fields


-- 
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]

Reply via email to