Skip to content

feat(mcp): add tags + typed metadata fields to update_dashboard#40957

Merged
rusackas merged 5 commits into
apache:masterfrom
aminghadersohi:mcp-update-dashboard
Jun 30, 2026
Merged

feat(mcp): add tags + typed metadata fields to update_dashboard#40957
rusackas merged 5 commits into
apache:masterfrom
aminghadersohi:mcp-update-dashboard

Conversation

@aminghadersohi

@aminghadersohi aminghadersohi commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

SUMMARY

Extends the update_dashboard MCP tool (added in #40399) with four metadata capabilities, instead of shipping a second, overlapping tool.

Added to UpdateDashboardRequest / the existing tool:

  • tags — full-replacement list of tag IDs, routed through the same validate_tags / update_tags helpers UpdateDashboardCommand uses (identical custom-tag semantics, permission + existence checks).
  • Typed json_metadata togglescross_filters_enabled, refresh_frequency (seconds, 0 = off), filter_bar_orientation (VERTICAL/HORIZONTAL), so an LLM does not have to hand-build the raw json_metadata_overrides dict for common operations.
  • Slug normalization — mirrors the REST DashboardPutSchema contract (strip, spaces → hyphens, drop chars outside [\w-]).
  • CSS validation parity — runs the same validate_css the REST update path uses, so the tool rejects CSS the API would reject.

Design notes:

  • A key set via both a typed field and json_metadata_overrides is rejected as ambiguous (clear validation error); the generic json_metadata_overrides dict remains an escape hatch for keys without a typed field.
  • Validation (CSS, tag permissions/existence, metadata conflicts) runs before any mutation, returning a structured error instead of failing deep in the commit.

Note: this branch was originally a standalone update_dashboard tool. After #40399 merged an update_dashboard tool first, this PR was rebased and refocused to build on that tool rather than duplicate it.

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 {"identifier": <id>, "tags": [<tag_id>], "refresh_frequency": 300} and verify tags are replaced and the refresh interval is stored in json_metadata.
  3. Call it with both cross_filters_enabled and json_metadata_overrides: {"cross_filters_enabled": ...} and verify it is rejected as a conflict.
  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
  • 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 17.18750% with 53 lines in your changes missing coverage. Please review.
✅ Project coverage is 64.55%. Comparing base (9dba4d0) to head (a2c740a).
⚠️ Report is 17 commits behind head on master.

Files with missing lines Patch % Lines
...set/mcp_service/dashboard/tool/update_dashboard.py 6.38% 44 Missing ⚠️
superset/mcp_service/dashboard/schemas.py 47.05% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40957      +/-   ##
==========================================
+ Coverage   55.85%   64.55%   +8.69%     
==========================================
  Files        2664     2664              
  Lines      146384   146472      +88     
  Branches    33852    33864      +12     
==========================================
+ Hits        81764    94556   +12792     
+ Misses      63880    50197   -13683     
- Partials      740     1719     +979     
Flag Coverage Δ
hive 39.20% <17.18%> (-0.03%) ⬇️
mysql 57.93% <17.18%> (?)
postgres 58.00% <17.18%> (?)
presto 40.77% <17.18%> (-0.03%) ⬇️
python 59.42% <17.18%> (+18.56%) ⬆️
sqlite 57.63% <17.18%> (?)
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.

@aminghadersohi aminghadersohi marked this pull request as ready for review June 12, 2026 21:18
@aminghadersohi aminghadersohi requested a review from eschutho June 12, 2026 21:20
@bito-code-review

bito-code-review Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #bed548

Actionable Suggestions - 0
Additional Suggestions - 2
  • superset/mcp_service/dashboard/tool/update_dashboard.py - 1
    • Missing theme_id and roles in response schema · Line 220-220
      The `DashboardInfo` schema omits `theme_id` and `roles` even though they’re updatable and listed in `_DIRECT_FIELDS`. Add `theme_id: int | None = None` and `roles: List[RoleInfo] = Field(default_factory=list)` to the `DashboardInfo` model in `schemas.py`.
  • superset/mcp_service/app.py - 1
    • Incomplete field documentation · Line 133-133
      The documentation line 133 omits 3 implemented fields (`cross_filters_enabled`, `filter_bar_orientation`, `certification_details`) and uses 'theme' instead of the actual schema parameter 'theme_id'. Update the description to list all 14 supported fields for accuracy and to help users discover all available options.
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py - 1
  • superset/mcp_service/dashboard/schemas.py - 1
Review Details
  • Files reviewed - 6 · Commit Range: 97239b7..97239b7
    • superset/mcp_service/app.py
    • superset/mcp_service/dashboard/schemas.py
    • superset/mcp_service/dashboard/tool/__init__.py
    • superset/mcp_service/dashboard/tool/update_dashboard.py
    • superset/mcp_service/mcp_config.py
    • tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset/mcp_service/dashboard/schemas.py Outdated
@bito-code-review

Copy link
Copy Markdown
Contributor

Yes, this addition is intended to provide a new MCP tool for partially updating dashboard metadata. The UpdateDashboardRequest schema defines the fields that can be updated (such as title, slug, published status, and various metadata fields), and the corresponding update_dashboard tool is being registered to allow these updates via the MCP service.

Comment thread tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py Outdated
@netlify

netlify Bot commented Jun 15, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit d9ba43f
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a42a1a93a8cfa0008199637
😎 Deploy Preview https://deploy-preview-40957--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread superset/mcp_service/dashboard/schemas.py Outdated
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
@bito-code-review

bito-code-review Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #a90e16

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset/mcp_service/dashboard/schemas.py - 1
    • Missing test for empty tag list · Line 740-747
      The `tags` field is correctly implemented and documented as a full-replacement list. However, the existing `test_update_tags` test only covers the case of adding new tags (`[7, 8]`). Add a test case for `{"tags": []}` to verify that clearing all tags works correctly, ensuring the empty-list path is validated.
Review Details
  • Files reviewed - 4 · Commit Range: 97239b7..b5c2e61
    • superset/mcp_service/app.py
    • superset/mcp_service/dashboard/schemas.py
    • superset/mcp_service/dashboard/tool/update_dashboard.py
    • tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@aminghadersohi

Copy link
Copy Markdown
Contributor Author

Re: "Missing test for empty tag list" — added test_update_tags_empty_list_clears in d73eb8b. It asserts {"dashboard_id": 3, "tags": []} reaches the command as {"tags": []} (a full replacement that clears all tags), guarding the is not None inclusion check against a regression to truthiness.

Comment thread superset/mcp_service/dashboard/schemas.py Outdated
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
@bito-code-review

bito-code-review Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #55969d

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset/mcp_service/dashboard/tool/update_dashboard.py - 1
    • Unused import removal · Line 33-41
      Two imports were removed from the top of the file: `serialize_chart_summary` and `user_can_view_data_model_metadata`. The code context confirms these are no longer referenced in the changed code path. Confirm this is intentional (not an accidental removal of a needed import).
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/mcp_service/dashboard/tool/update_dashboard.py - 1
Review Details
  • Files reviewed - 2 · Commit Range: b5c2e61..d73eb8b
    • superset/mcp_service/dashboard/tool/update_dashboard.py
    • tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@bito-code-review

bito-code-review Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #925445

Actionable Suggestions - 0
Review Details
  • Files reviewed - 2 · Commit Range: d73eb8b..2f87654
    • superset/mcp_service/dashboard/schemas.py
    • tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@aminghadersohi aminghadersohi changed the title feat(mcp): add update_dashboard tool feat(mcp): add tags + typed metadata fields to update_dashboard Jun 26, 2026
@aminghadersohi aminghadersohi requested a review from rusackas June 26, 2026 15:45
Comment thread superset/mcp_service/dashboard/schemas.py
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py
@bito-code-review

bito-code-review Bot commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #b4634c

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 7ea0150..7ea0150
    • superset/mcp_service/dashboard/schemas.py
    • superset/mcp_service/dashboard/tool/update_dashboard.py
    • tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
Builds on the update_dashboard tool added in apache#40399 rather than adding a
second tool. Extends its UpdateDashboardRequest with:

- tags: full-replacement list of tag IDs, routed through the same
  validate_tags/update_tags helpers UpdateDashboardCommand uses
- cross_filters_enabled, refresh_frequency, filter_bar_orientation: typed
  convenience fields that fold into json_metadata (so an LLM need not
  hand-build json_metadata_overrides for common toggles)
- slug normalization mirroring the REST DashboardPutSchema contract
- validate_css parity so the tool rejects the same CSS the REST path does

A key set via both a typed field and json_metadata_overrides is rejected
as ambiguous; the generic overrides dict remains an escape hatch.
Collapses the two-line `parsed = ...; if isinstance(parsed, dict):` into
a single walrus expression to satisfy the auto-walrus pre-commit hook.
- Slug normalizer: raise ValueError when non-empty input normalizes to
  empty string (e.g. "!!!") instead of silently clearing the slug.
  Adds a test case for the new validation.

- Tag validation: catch SQLAlchemyError in the pre-flight validate_tags
  call, which runs before the main SQLAlchemyError handler and was
  previously unguarded against DB errors.

- String concatenation: make all + joins explicit (no implicit ISC) in
  _collect_metadata_overrides to satisfy ruff-format 0.9.7.

- Type annotations: add return types to mcp_server fixture and
  _mock_dashboard helper; add Mock/object param types to all test methods.
- Annotate _TYPED_METADATA_FIELDS as tuple[str, ...]
- Annotate local dict comprehension `typed` as dict[str, Any]
- Annotate `metadata_overrides` as dict[str, Any]
- Annotate `validation_error` as DashboardError | None
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py Outdated
Comment thread superset/mcp_service/dashboard/schemas.py
The slug validator was raising ValueError for whitespace-only slugs (e.g.
" ") instead of normalizing them to empty string the way the REST
DashboardPutSchema does. Added an early-strip check so whitespace-only
inputs return "" (clears slug) consistent with the REST update path.

The test's match regex "normalizes to an empty" did not match the actual
error message; updated to "characters that are removed during normalization"
and added a whitespace-only assertion.
Comment thread superset/mcp_service/dashboard/schemas.py
Comment thread superset/mcp_service/dashboard/schemas.py
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py
Comment thread superset/mcp_service/dashboard/tool/update_dashboard.py
rusackas
rusackas approved these changes Jun 29, 2026
@bito-code-review

bito-code-review Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #8d78b0

Actionable Suggestions - 0
Filtered by Review Rules

Bito filtered these suggestions based on rules created automatically for your feedback. Manage rules.

  • superset/mcp_service/dashboard/schemas.py - 1
Review Details
  • Files reviewed - 3 · Commit Range: 7ea0150..a2c740a
    • superset/mcp_service/dashboard/tool/update_dashboard.py
    • superset/mcp_service/dashboard/schemas.py
    • tests/unit_tests/mcp_service/dashboard/tool/test_update_dashboard.py
  • Files skipped - 0
  • Tools
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@rusackas rusackas merged commit c60d8bb into apache:master Jun 30, 2026
59 checks passed
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.

2 participants