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

   ### SUMMARY
   
   The MCP server can create, read, and update charts and dashboards, but 
cannot **delete** them — so an agent that creates exploratory charts/dashboards 
has no way to clean them up. This PR adds two mutating tools:
   
   - **`delete_chart`** — delete a chart by numeric ID or UUID.
   - **`delete_dashboard`** — delete a dashboard by numeric ID, UUID, or slug 
(removes the dashboard container only; its charts are left intact).
   
   Both delegate to the existing `DeleteChartCommand` / 
`DeleteDashboardCommand`, so authorization and safety are enforced by the 
command layer, not reimplemented:
   
   - **Ownership** is checked via `security_manager.raise_for_ownership` (plus 
class-level `Chart`/`Dashboard` write permission from the 
`@tool(tags=["mutate"])` decorator).
   - Objects with **attached alerts/reports** cannot be deleted until those are 
removed (surfaced as a clear `ReportsExist` error).
   
   The response schema includes `permission_denied`, mirroring 
`add_chart_to_existing_dashboard`, so an LLM can tell an authorization failure 
(do not retry; ask the user) from a transient error. Both tools are registered 
in `app.py` and listed in `DEFAULT_INSTRUCTIONS`.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   python -m pytest \
     tests/unit_tests/mcp_service/chart/tool/test_delete_chart.py \
     tests/unit_tests/mcp_service/dashboard/tool/test_delete_dashboard.py -q
   ```
   
   8 tests pass, covering each tool: not-found, success, permission-denied, and 
blocked-by-reports. `ruff` check + format and `mypy` are clean.
   
   ### ADDITIONAL INFORMATION
   
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [x] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-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