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

   ### SUMMARY
   
   The MCP `update_dashboard` tool can edit a dashboard's title, description, 
slug, `published` flag, tags, CSS, layout and `json_metadata`, but it had **no 
way to set the dashboard's owners** (and no other MCP tool sets owners either).
   
   Because of this, a dashboard created through the MCP (`generate_dashboard`) 
is owned only by the MCP agent's user. An unpublished dashboard is visible only 
to its owners, so the human driving the agent cannot see or manage their own 
new dashboard, and no MCP client can transfer ownership to them. The only 
workarounds today are the Superset UI or direct metadata-DB access.
   
   This PR adds an optional `owners` field to `update_dashboard`: a 
full-replacement list of user IDs, mirroring the REST dashboard owners 
semantics.
   
   - Unknown user IDs are rejected up front with an `OwnersNotFound` error.
   - An empty list clears all owners.
   - Omitting the field leaves owners unchanged.
   
   Editorship is still enforced via `raise_for_editorship`, so only current 
owners or an Admin can change owners (same guarantee as the REST PUT).
   
   Discussion: https://github.com/apache/superset/discussions/42001
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   N/A — MCP tool schema/behavior change, no UI.
   
   ### TESTING INSTRUCTIONS
   
   Unit tests added in 
`tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py`:
   
   - `test_update_owners_replaces_list` — owners fully replaced with the 
resolved users; `owners` appears in `changed_fields`.
   - `test_update_owners_unknown_id_errors` — an unknown ID returns 
`OwnersNotFound` with no mutation and no commit.
   
   Manual: call `update_dashboard` with `{"identifier": <id>, "owners": 
[<user_id>, ...]}` and verify owners change; a non-existent ID returns 
`OwnersNotFound`; an empty list clears owners; omitting the field leaves owners 
unchanged.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: linked GitHub Discussion apache/superset#42001 
(this repo routes feature requests to Discussions)
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   > Note: unit tests were added and the changed files pass `py_compile`, but 
the full test suite / pre-commit were not run locally (no dev environment 
available in this setup). Relying on CI to validate formatting, typing and 
tests.
   


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