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

   ## Summary
   
   Fixes the `select_columns` parameter in MCP list tools (`list_charts`, 
`list_datasets`, `list_dashboards`) which was broken and not filtering response 
fields.
   
   **Root Cause:**
   Commit 84279acd2f changed the list tools to call `model_validate()` after 
filtering:
   ```python
   filtered = result.model_dump(mode="json", context={"select_columns": ...})
   return ChartList.model_validate(filtered)  # ← Bug: recreates models with 
None defaults
   ```
   
   This recreated the Pydantic models from the filtered dict, causing all 
optional fields to be re-added with `None` values, effectively undoing the 
filtering.
   
   **Fix:**
   Restore the original behavior from PR #36035 - return the dict directly from 
`model_dump()` and let FastMCP handle serialization:
   ```python
   if request.select_columns:
       return result.model_dump(mode="json", context={"select_columns": 
request.select_columns})
   return result.model_dump(mode="json")
   ```
   
   ## Test Plan
   
   - [ ] Test `list_datasets` with `select_columns: ["id", "table_name"]` - 
response should only contain those fields
   - [ ] Test `list_charts` with `select_columns: ["id", "slice_name"]` - 
response should only contain those fields  
   - [ ] Test `list_dashboards` with `select_columns: ["id", 
"dashboard_title"]` - response should only contain those fields
   - [ ] Test without `select_columns` - full response should be returned
   
   🤖 Generated with [Claude Code](https://claude.ai/code)


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