Skip to content

feat(mcp): add delete_dashboard tool#40956

Draft
aminghadersohi wants to merge 1 commit into
masterfrom
mcp-delete-dashboard
Draft

feat(mcp): add delete_dashboard tool#40956
aminghadersohi wants to merge 1 commit into
masterfrom
mcp-delete-dashboard

Conversation

@aminghadersohi

Copy link
Copy Markdown
Contributor

SUMMARY

Adds a delete_dashboard tool to the Superset MCP service. AI agents that generate test dashboards (e.g. via generate_dashboard) previously had no way to clean them up — this closes that CRUD gap.

Design:

  • Params: dashboard_id (int) and a required confirm boolean safety gate. The tool refuses with a clear error unless confirm=true is explicitly passed, forcing the caller (LLM) to state destructive intent. Single delete only — no bulk.
  • Backed by the existing DeleteDashboardCommand, so ownership checks, the report-schedule guard, and transactional semantics are identical to the REST API delete path.
  • The dashboard is fetched first so the response echoes what was deleted (id, title, slug) in a structured DeleteDashboardResponse with deleted: bool and an error field. Title/slug are sanitized before LLM exposure, matching the other dashboard tools.
  • Structured error responses for: not confirmed, not found, forbidden (DashboardForbiddenError), and delete failure (including associated alerts/reports).
  • Tool is tagged mutate with class_permission_name="Dashboard", method_permission_name="write", and MCP annotations readOnlyHint=False, destructiveHint=True.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N/A — backend MCP tool only, no UI changes.

TESTING INSTRUCTIONS

  1. pytest tests/unit_tests/mcp_service/dashboard/tool/test_delete_dashboard.py
  2. Or manually: start the MCP service, call delete_dashboard with {"dashboard_id": <id>, "confirm": false} and verify it refuses; retry with "confirm": true and verify the dashboard is deleted and the response echoes id/title/slug.

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 42.62295% with 35 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.17%. Comparing base (f79a88c) to head (97d20ac).
⚠️ Report is 13 commits behind head on master.

Files with missing lines Patch % Lines
...set/mcp_service/dashboard/tool/delete_dashboard.py 21.62% 29 Missing ⚠️
superset/mcp_service/dashboard/schemas.py 73.91% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40956      +/-   ##
==========================================
- Coverage   64.19%   64.17%   -0.02%     
==========================================
  Files        2655     2656       +1     
  Lines      143925   143986      +61     
  Branches    33181    33185       +4     
==========================================
+ Hits        92386    92408      +22     
- Misses      49919    49956      +37     
- Partials     1620     1622       +2     
Flag Coverage Δ
hive 39.46% <42.62%> (+<0.01%) ⬆️
mysql 58.17% <42.62%> (-0.02%) ⬇️
postgres 58.24% <42.62%> (-0.02%) ⬇️
presto 41.05% <42.62%> (+<0.01%) ⬆️
python 59.71% <42.62%> (-0.03%) ⬇️
sqlite 57.86% <42.62%> (-0.02%) ⬇️
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant