aminghadersohi opened a new pull request, #44797:
URL: https://github.com/apache/superset/pull/44797
### SUMMARY
Add opt-in scoping to `get_dashboard_layout` so large tabbed dashboards can
be explored without exceeding the response-size guard:
- `tabs_only=true` returns a compact tab tree with IDs, names, parents,
zero-based depths, and distinct descendant chart counts, without chart IDs or
positions.
- `tab="<ID or exact title>"` returns one tab and its descendants with chart
positions. IDs take precedence; ambiguous titles produce an actionable error.
Both options can be combined.
- Oversized-layout errors suggest these options through the existing
tool-specific hint mechanism.
Requests using only `identifier` or `permalink_key` retain their existing
output. Permalink active-tab/filter state and full-dashboard ancestry remain
unchanged. No response-size limits are increased.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable (MCP response only). Previously, an oversized full layout was
rejected without layout-specific recovery instructions. Callers can discover
the tab tree and then retrieve a smaller subtree:
```json
{"request": {"identifier": 123, "tabs_only": true}}
```
```json
{"request": {"identifier": 123, "tab": "Overview"}}
```
### TESTING INSTRUCTIONS
- Call `get_dashboard_layout` on a tabbed dashboard without new options and
verify the existing full response.
- Repeat with `tabs_only=true`; verify every tab appears with parent, depth,
and chart count, and `charts` is empty.
- Pass a tab ID or exact title; verify only that subtree's tabs and chart
positions appear. Duplicate titles require an ID.
- Repeat using a dashboard permalink and verify active-tab state is
preserved, even when explicitly selecting a different tab.
- Use a layout exceeding the configured response-size limit; verify the
error suggests both new options.
Automated validation:
- Regression tests were run before implementation and failed for the new
modes and oversized hint.
- Generated fixture: 114 tabs and 404 charts; compact output stays below
25,000 serialized bytes and below one-third of a 20,000-token legacy bytes/4
estimate. The guard on master measures exact UTF-8 bytes.
- Layout tests: 33 passed.
- Full MCP unit suite (`pytest -q -n 4 tests/unit_tests/mcp_service`): 5,630
passed, 4 skipped.
- Changed-file pre-commit checks, including mypy and pylint: passed.
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [x] Introduces new feature or API
- [ ] Removes existing feature or API
--
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]