Skip to content

fix(mcp): clarify chart preview URL metadata - #39731

Merged
richardfogaca merged 3 commits into
apache:masterfrom
richardfogaca:richardfogaca/clarify-chart-preview-url-metadata
Apr 29, 2026
Merged

richardfogaca merged 3 commits into
apache:masterfrom
richardfogaca:richardfogaca/clarify-chart-preview-url-metadata

Conversation

@richardfogaca

Copy link
Copy Markdown
Contributor

SUMMARY

Clarifies MCP chart preview metadata and guidance now that URL previews return interactive Explore links rather than static screenshot image URLs.

This follow-up to #39719 updates:

  • URLPreview width/height descriptions to refer to requested Explore viewport dimensions
  • URLPreview.supports_interaction to default to true
  • chart preview tool guidance/docstrings so clients see the supported ASCII, URL, table, and Vega-Lite formats

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Not applicable; MCP schema/documentation metadata only.

TESTING INSTRUCTIONS

PYENV_VERSION=superset pre-commit run --files superset/mcp_service/app.py superset/mcp_service/chart/schemas.py superset/mcp_service/chart/tool/get_chart_preview.py tests/unit_tests/mcp_service/chart/tool/test_get_chart_preview.py
PYENV_VERSION=superset pytest tests/unit_tests/mcp_service/chart/tool/test_get_chart_preview.py -q

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 Apr 28, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.49%. Comparing base (4b42f82) to head (1c90a48).
⚠️ Report is 9 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #39731      +/-   ##
==========================================
- Coverage   64.49%   64.49%   -0.01%     
==========================================
  Files        2566     2566              
  Lines      133960   133958       -2     
  Branches    31116    31115       -1     
==========================================
- Hits        86394    86392       -2     
  Misses      46071    46071              
  Partials     1495     1495              
Flag Coverage Δ
hive 39.74% <100.00%> (ø)
mysql 60.19% <100.00%> (ø)
postgres 60.27% <100.00%> (ø)
presto 41.51% <100.00%> (ø)
python 61.83% <100.00%> (ø)
sqlite 59.90% <100.00%> (ø)
unit 100.00% <ø> (ø)

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

☔ View full report in Codecov by Sentry.
📢 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.

@richardfogaca richardfogaca self-assigned this Apr 28, 2026
@richardfogaca
richardfogaca marked this pull request as ready for review April 28, 2026 17:19
Copilot AI review requested due to automatic review settings April 28, 2026 17:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates MCP chart preview metadata/documentation to reflect that URL previews now return interactive Explore links (not screenshot image URLs), and clarifies the available preview formats.

Changes:

  • Update URLPreview schema descriptions for width/height and default supports_interaction=True
  • Refresh tool docstring and MCP default instructions to describe supported preview formats (ASCII/URL/table/Vega-Lite)
  • Adjust unit tests to expect Explore URLs and interactive defaults

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
tests/unit_tests/mcp_service/chart/tool/test_get_chart_preview.py Updates expectations to Explore URL format and interactive default.
superset/mcp_service/chart/tool/get_chart_preview.py Revises docstring to describe supported preview output types beyond screenshots.
superset/mcp_service/chart/schemas.py Clarifies URL preview metadata and defaults supports_interaction to true.
superset/mcp_service/app.py Updates general MCP instructions to reflect new chart preview output options.

Comment thread tests/unit_tests/mcp_service/chart/tool/test_get_chart_preview.py Outdated
Comment thread tests/unit_tests/mcp_service/chart/tool/test_get_chart_preview.py Outdated

@aminghadersohi aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by Claude (AI assistant) on behalf of @preset-io/amin

Thanks for the cleanup! A few things worth discussing before this merges:

Scope of PR: The description says "schema/documentation metadata only" but the diff includes API-breaking field removals from ChartInfo (owners, changed_by, created_by), a new sanitization_warnings field + model validator on GenerateChartRequest, and a change to the exception handler in a production path. It would help future reviewers and changelog readers to call these out explicitly in the summary.

Exception narrowing (get_chart_preview.py, outer except clause): The original except Exception ensured callers always received a structured ChartError. The new explicit union omits IndexError, RuntimeError, PermissionError, etc. An unexpected exception type will now propagate unhandled. Consider either restoring the catch-all with an inner isinstance guard for re-raise, or adding Exception as a final catch with a distinct log level for unexpected types.

Default format change: GetChartPreviewRequest.format silently changes default from "url" to "ascii". Clients relying on the default will now get different output. Worth a note in SUMMARY and UPDATING.md if this is intentional.

created_by_fk removal: Any client currently passing {"col": "created_by_fk", ...} to list_charts will get a Pydantic validation error instead of results. If removing this is intentional for privacy, a migration note ("use search parameter instead") would help.

Test host: Copilot's comment about localhost:8088 in the unit test is valid and easy to fix — the dimension test a few lines below already uses example.com.

None check after typed required field (get_chart_preview.py): The if request.identifier is None guard is dead code — identifier is typed int | str and marked required, so it can never reach that branch.

The privacy guardrails (app.py instructions, ChartInfo field removals) are well-designed and appropriate. The GenerateChartRequest aliases and sanitization_warnings design are reasonable. The main blocker is the exception handler regression.

@bito-code-review

bito-code-review Bot commented Apr 28, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #9e46a0

Actionable Suggestions - 0
Review Details
  • Files reviewed - 4 · Commit Range: 80c52f1..80c52f1
    • superset/mcp_service/app.py
    • superset/mcp_service/chart/schemas.py
    • superset/mcp_service/chart/tool/get_chart_preview.py
    • tests/unit_tests/mcp_service/chart/tool/test_get_chart_preview.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

@richardfogaca

Copy link
Copy Markdown
Contributor Author

Thanks @aminghadersohi. I checked #39731 against the current master base, and the broader items you called out appear to come from prior merged MCP changes rather than this PR’s diff.

I pushed 1c90a48 to address the direct test-host issue by replacing the illustrative localhost:8088 URL with example.com.

I agree the exception-handler concern is worth a focused follow-up, but since it predates this metadata cleanup, I’d prefer to handle it separately so this PR stays scoped to the chart preview wording/schema-test updates.

@bito-code-review

bito-code-review Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #1cd4b5

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 80c52f1..1c90a48
    • tests/unit_tests/mcp_service/chart/tool/test_get_chart_preview.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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix on the test host — is the right call there. Approving; the exception narrowing concern is worth a follow-up but not a blocker given FastMCP's top-level error handling. LGTM otherwise.

@aminghadersohi aminghadersohi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the quick fix on the test host — using example.com is the right call there. Approving; the exception narrowing concern is worth a follow-up but not a blocker given FastMCP's top-level error handling. LGTM otherwise.

@richardfogaca
richardfogaca merged commit 549aff7 into apache:master Apr 29, 2026
65 of 68 checks passed
@richardfogaca
richardfogaca deleted the richardfogaca/clarify-chart-preview-url-metadata branch April 29, 2026 15:37
bestlong pushed a commit to bestlong/superset that referenced this pull request May 7, 2026
qfcwell pushed a commit to qfcwell/superset that referenced this pull request May 12, 2026
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.

3 participants