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

   ### SUMMARY
   Adds a new MCP tool, `update_dashboard`, enabling partial updates of 
dashboard metadata via the MCP service. This unblocks post-creation workflows 
(rename, publish/unpublish, styling, certification, ownership) that previously 
required the REST API or UI.
   
   Supported fields:
   - Direct fields (via `UpdateDashboardCommand`): `dashboard_title` 
(XSS-sanitized), `slug`, `published`, `css`, `theme_id`, `certified_by`, 
`certification_details`, `owners`/`roles`/`tags` (full-replacement ID lists)
   - Convenience fields merged into `json_metadata`: `color_scheme`, 
`cross_filters_enabled`, `refresh_frequency` (seconds, 0 = off), 
`filter_bar_orientation` (`VERTICAL`/`HORIZONTAL`)
   
   Design notes:
   - Backed by `UpdateDashboardCommand` (command/DAO pattern), not HTTP calls; 
ownership is checked up front via `security_manager.raise_for_ownership` and 
again by the command.
   - `json_metadata` updates read the dashboard's full current metadata blob, 
merge the requested changes, and write the complete blob back — 
`DashboardDAO.set_dash_metadata` resets absent keys to defaults (e.g. 
`expanded_slices` → `{}`), so writing a partial blob would silently destroy 
state.
   - Tool is excluded from MCP response caching 
(`MCP_CACHE_CONFIG.excluded_tools`), matching other mutating tools.
   - Error responses are wrapped for LLM-context safety, consistent with the 
other dashboard tools.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   N/A (MCP service, no UI changes)
   
   ### TESTING INSTRUCTIONS
   1. Start the MCP service and connect an MCP client.
   2. Call `update_dashboard` with `{"dashboard_id": <id>, "dashboard_title": 
"New Title", "published": true}` and verify the dashboard is renamed and 
published.
   3. Call it with `{"dashboard_id": <id>, "color_scheme": "supersetColors"}` 
on a dashboard that has expanded slices / label colors configured, and verify 
those settings are preserved after the update.
   4. Run the unit tests: `pytest 
tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py`
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration (follow approval process in 
[SIP-59](https://github.com/apache/superset/issues/13351))
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API


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