Skip to content

fix(mcp): preserve deduplicated chart tool input schemas - #44575

Merged
aminghadersohi merged 6 commits into
apache:masterfrom
aminghadersohi:sc-121707-mcp-schema-size-2
Sep 25, 2026
Merged

aminghadersohi merged 6 commits into
apache:masterfrom
aminghadersohi:sc-121707-mcp-schema-size-2

Conversation

@aminghadersohi

@aminghadersohi aminghadersohi commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

SUMMARY

Make chart-tool argument schemas retrievable without expanding shared models or weakening their contract.

The search serializer recursively inlined every reference and removed $defs. This duplicated chart submodels, discarded nullable alternatives and reference siblings, and replaced recursive references with unconstrained objects. Remove that lossy pass: retain the original definitions, references, discriminator mappings, nullable unions, and constraints. Existing title/output-schema stripping and description limits remain unchanged. Authorization, sanitization, and response-size guards are untouched.

The legacy compact_schemas setting continues to select the default description limit; documentation explains reference resolution relative to each tool's inputSchema. Search ranking and description-truncation behavior are outside this change.

Chart tools shrink, but 66 of 72 tools grow, with non-chart tools growing by about 9% in aggregate, as gabotorresruiz measured in his review.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

No UI change. Measured the actual registered Apache inventory entries, including tool metadata, using compact JSON (ensure_ascii=False, separators=(',', ':')), UTF-8 byte counts, and tiktoken 0.14.0 / cl100k_base. Tokens are BPE client estimates, not Claude-tokenizer counts; no bytes/token conversion is used.

Tool Before bytes After bytes Before tokens After tokens
generate_chart 97,013 49,531 23,543 11,849
update_chart 104,163 53,395 25,227 12,759
generate_explore_link 96,581 49,230 23,478 11,806

Reference duplication accounts for approximately half the inventory size. Preserving the complete contract does not meet the proposed 50,000-byte target for update_chart: its regression budget is explicitly 55,000 bytes, not a raised production cap. The other two budgets are 50,000 bytes; each token budget is independently 20,000 tokens.

A local fixture using the existing gateway renderer, MCP Tool canonicalization and one-definition pagination also validates delivery overhead:

Tool Rendered content bytes, before → after Rendered content tokens, before → after After gateway guard token estimate
generate_chart 103,564 → 52,807 29,322 → 14,724 14,801
update_chart 111,144 → 56,883 31,388 → 15,823 15,900
generate_explore_link 103,093 → 52,466 29,219 → 14,641 14,718

All three fit the existing 100KB/25k-token delivery limits individually, with no required constraint removed.

TESTING INSTRUCTIONS

Using the development dependencies (including the pinned test-only tokenizer):

pytest tests/unit_tests/mcp_service/test_tool_search_transform.py   tests/unit_tests/mcp_service/test_chart_tool_inventory.py   tests/unit_tests/mcp_service/test_tool_inventory.py
pytest tests/unit_tests/mcp_service/chart/tool/test_generate_chart.py   tests/unit_tests/mcp_service/chart/tool/test_update_chart.py   tests/unit_tests/mcp_service/explore/tool/test_generate_explore_link.py
  • 207 passed in the search/inventory suite; 178 passed in the existing tool execution suites.
  • The chart/search regression coverage includes 11 cases: three real per-tool inventory budgets, three full-schema/reference fidelity checks, three schema-first FastMCP invocations with typed side-effect-free fixtures, and two shared-schema fidelity tests.
  • Added 145 full-inventory regression cases: separate byte/token budgets and complete schema fidelity checks for all 72 registered tools, plus a check requiring budgets for newly registered tools.
  • Each published schema is checked by a Draft 2020-12 validator, every reference/discriminator target resolves locally, and its content equals the original input schema except the existing title stripping. Valid table arguments pass; invalid column-name constraints remain enforced.
  • Restoring only the original server.py makes all three size regression cases fail (97,013 / 104,163 / 96,581 bytes).
  • Ran uvx pre-commit run --files across every branch-changed file; all applicable hooks pass, including mypy, pylint, and ruff.

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

@bito-code-review

bito-code-review Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #67be96

Actionable Suggestions - 0
Additional Suggestions - 4
  • tests/unit_tests/mcp_service/test_chart_tool_inventory.py - 3
    • Missing local type annotations · Line 83-94
      BITO.md adaptive rule 13153 requires explicit annotations for all local variables in test files, even when inferable. Most locals here (`tool`, `serializer`, `entry`, `text`, `byte_count`, `token_count`, and in the other tests `original`, `schema`, `refs`, `validator`, `table_ref`, `result`) are unannotated while `request`/`target` are annotated — inconsistent. Annotate all locals per the rule.
    • Duplicated serializer construction · Line 83-83
      `_create_search_result_serializer(MCP_TOOL_SEARCH_CONFIG)([tool])[0]` is rebuilt identically at lines 84, 103 and 157. If one site drifts to a different config, the three tests would silently measure/validate different serializations. Extract a module-level serializer or helper and reuse it in all three tests.
    • Inline token budget literal · Line 94-94
      `assert token_count <= 20_000` (line 94) inlines the token budget as a bare literal while the sibling byte budgets are named in `TOOL_BUDGETS` and explained by the header comment. A named constant (e.g. `TOKEN_BUDGET = 20_000`) keeps the budget policy in one place beside the byte budgets.
  • tests/unit_tests/mcp_service/test_tool_search_transform.py - 1
    • Misleading test name · Line 459-460
      The changed assertions verify `schema["$defs"]` and the `$ref` items survive intact, and the updated docstring says serialization "keeps shared definitions" — but the function is still named `test_create_serializer_compacts_schemas`. The name now contradicts the behavior it asserts (verified in `_create_search_result_serializer`: with `include_schemas=True` no compaction happens). Rename the test to match, e.g. `test_create_serializer_preserves_schemas`.
Review Details
  • Files reviewed - 6 · Commit Range: 25e5533..25e5533
    • docs/admin_docs/configuration/mcp-server.mdx
    • pyproject.toml
    • requirements/development.txt
    • superset/mcp_service/server.py
    • tests/unit_tests/mcp_service/test_chart_tool_inventory.py
    • tests/unit_tests/mcp_service/test_tool_search_transform.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 an incremental AI Review.

  • /review full - 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

@github-actions github-actions Bot added doc Namespace | Anything related to documentation dependencies:python labels Sep 23, 2026
@netlify

netlify Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit 24812ac
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6ab5c34ccb552000099f1505
😎 Deploy Preview https://deploy-preview-44575--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.

@aminghadersohi

Copy link
Copy Markdown
Contributor Author

Measured, reproducible, and roughly a 49% cut on all three tools — and the handoff note on line ranges is genuinely useful for the two follow-ups that touch this file next. Two things before this is ready.

1. Removing _compact_schema changes every tool, not just the three in the ticket. The block at original 302–406 is gone and the serializer no longer compacts, so the schema shipped for all ~63–68 tools in the inventory is now whatever the raw model emits. For the three chart tools that is a large win because they were paying for recursive inlining. For a tool whose schema has few or no repeated sub-models, compaction may have been doing nothing — but for anything in between, this could make it bigger, and the new test_chart_tool_inventory.py only covers 9 chart cases.

Please measure the full inventory before and after, not just the three. If some non-chart tool regresses, that is worth knowing now rather than from a client. The ticket asked for per-tool inventory budgets; the inventory is more than the chart tools.

2. Three CI failures need attribution. babel-extract is the fleet-wide one (SC-121633, fixed upstream by #44509) — ignore it. But test-load-examples, testcontainers (starrocks, 15) and playwright-tests (chromium) are failing here and not on the adjacent PRs I checked. They look unrelated to an MCP schema change, and the dev-extra addition of tiktoken/regex is the one plausible connection worth ruling out. Either attribute them to something upstream with evidence, or fix them.

Nothing else from me. tiktoken sitting under development rather than as a runtime dependency is the right call, and keeping the 9 regression cases in a new file instead of the shared one was thoughtful.

@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 81.05%. Comparing base (f8f293d) to head (26a6334).
⚠️ Report is 36 commits behind head on master.

Files with missing lines Patch % Lines
superset/mcp_service/server.py 66.66% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff             @@
##           master   #44575       +/-   ##
===========================================
+ Coverage   66.14%   81.05%   +14.91%     
===========================================
  Files        2950     2954        +4     
  Lines      177666   178105      +439     
  Branches    41177    41233       +56     
===========================================
+ Hits       117513   144364    +26851     
+ Misses      57649    31036    -26613     
- Partials     2504     2705      +201     
Flag Coverage Δ
hive 36.82% <0.00%> (-0.05%) ⬇️
mysql 56.03% <0.00%> (+<0.01%) ⬆️
postgres 56.03% <0.00%> (+<0.01%) ⬆️
presto 38.72% <0.00%> (-0.08%) ⬇️
python 85.38% <66.66%> (+29.03%) ⬆️
sqlite 55.75% <0.00%> (+<0.01%) ⬆️
unit 77.66% <66.66%> (?)

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 and others added 2 commits September 23, 2026 12:07
Remove empty parentheses from @pytest.mark.asyncio() to match ruff
PT023 (pytest-incorrect-mark-parentheses-style) style requirements.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@bito-code-review

bito-code-review Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #bd9356

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 25e5533..d6e5baf
    • tests/unit_tests/mcp_service/test_chart_tool_inventory.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 an incremental AI Review.

  • /review full - 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

Measured all 72 registered tools, not only chart tools, comparing the pre-change serializer at f8f293d266 with 90fe26612e. Same registered tool models/config on both sides; complete serialized entries including metadata; compact JSON (ensure_ascii=False, separators=(',', ':')), UTF-8 bytes, and tiktoken 0.14.0 / cl100k_base. Tokens are BPE estimates, not Claude-tokenizer counts.

Totals (sum of individual entries): 531,433 → 348,099 bytes (−34.50%); 126,042 → 81,354 tokens (−35.45%). Four tools shrink, two are unchanged, and 66 grow. Every increase is identified by its positive deltas below. The additional large win outside the original three is update_chart_preview: −49,943 bytes / −12,275 tokens.

The increases total +12,210 bytes / +3,421 tokens across those 66 tools. The largest individual increase is manage_native_filters, +706 bytes / +210 tokens, ending at 6,544 bytes / 1,438 tokens. These are small absolute increases from retaining nullable alternatives, $defs/$ref wrappers, and reference-sibling metadata that the old pass discarded. They are accepted costs of preserving the original published schema, not repeated-model expansion; reinstating the old simplification would lose fidelity. No growing entry exceeds 6,544 bytes or 1,438 tokens, so no material delivery-size regression was found and no additional runtime change was needed.

Added test_tool_inventory.py: 72 independent byte/token budget cases, 72 complete-schema/non-mutation checks, and an inventory-completeness check so new tools cannot silently escape coverage. 207 inventory/search tests and 178 execution tests pass; all applicable branch-file pre-commit hooks pass. Injecting schema growth into get_database_info makes its budget case fail as expected.

Full inventory: every tool, including all 66 increases
Tool Bytes before → after Δ bytes Tokens before → after Δ tokens
add_chart_to_existing_dashboard 1,259 → 1,372 +113 281 → 312 +31
apply_dashboard_filters 2,553 → 2,789 +236 560 → 625 +65
create_dataset 1,491 → 1,648 +157 321 → 365 +44
create_theme 920 → 989 +69 203 → 221 +18
create_virtual_dataset 2,887 → 3,536 +649 618 → 792 +174
delete_chart 877 → 946 +69 192 → 210 +18
delete_dashboard 878 → 955 +77 188 → 206 +18
duplicate_dashboard 1,645 → 1,728 +83 340 → 359 +19
execute_sql 1,791 → 1,970 +179 377 → 429 +52
find_users 1,319 → 1,384 +65 301 → 320 +19
generate_bug_report 2,040 → 2,426 +386 449 → 559 +110
generate_chart 97,013 → 49,531 -47,482 23,543 → 11,849 -11,694
generate_dashboard 3,047 → 3,296 +249 637 → 709 +72
generate_explore_link 96,581 → 49,230 -47,351 23,478 → 11,806 -11,672
get_annotation_layer_info 712 → 803 +91 158 → 181 +23
get_chart_data 2,526 → 2,709 +183 554 → 608 +54
get_chart_info 3,279 → 3,462 +183 721 → 777 +56
get_chart_preview 3,027 → 3,300 +273 661 → 744 +83
get_chart_sql 1,780 → 1,905 +125 390 → 428 +38
get_chart_type_schema 701 → 701 +0 149 → 149 +0
get_compatible_dimensions 1,236 → 1,385 +149 242 → 281 +39
get_compatible_metrics 1,227 → 1,370 +143 243 → 282 +39
get_dashboard_data 2,188 → 2,295 +107 484 → 514 +30
get_dashboard_datasets 911 → 998 +87 195 → 218 +23
get_dashboard_info 2,818 → 2,953 +135 609 → 648 +39
get_dashboard_layout 1,356 → 1,467 +111 284 → 314 +30
get_database_info 1,222 → 1,299 +77 277 → 298 +21
get_dataset_info 2,126 → 2,201 +75 507 → 528 +21
get_instance_info 604 → 710 +106 127 → 156 +29
get_layer_annotation_info 905 → 996 +91 196 → 219 +23
get_query_info 848 → 919 +71 195 → 216 +21
get_report_info 1,159 → 1,232 +73 248 → 269 +21
get_rls_filter_info 761 → 840 +79 176 → 201 +25
get_role_info 675 → 744 +69 156 → 177 +21
get_saved_query_info 935 → 1,016 +81 224 → 247 +23
get_schema 876 → 941 +65 183 → 202 +19
get_table 3,453 → 3,707 +254 798 → 877 +79
get_tag_info 825 → 892 +67 184 → 205 +21
get_task_info 888 → 957 +69 200 → 221 +21
get_theme_info 809 → 880 +71 173 → 194 +21
get_user_info 805 → 874 +69 184 → 203 +19
health_check 590 → 590 +0 127 → 127 +0
list_annotation_layers 2,245 → 2,540 +295 499 → 574 +75
list_charts 4,635 → 4,946 +311 1,030 → 1,118 +88
list_dashboards 4,120 → 4,419 +299 918 → 1,000 +82
list_databases 3,119 → 3,386 +267 694 → 767 +73
list_datasets 4,195 → 4,486 +291 919 → 1,000 +81
list_layer_annotations 2,481 → 2,738 +257 569 → 634 +65
list_metrics 1,527 → 1,708 +181 315 → 368 +53
list_queries 2,555 → 2,812 +257 577 → 648 +71
list_reports 3,458 → 3,717 +259 776 → 847 +71
list_rls_filters 2,225 → 2,496 +271 509 → 587 +78
list_roles 2,340 → 2,591 +251 541 → 612 +71
list_saved_queries 2,524 → 2,801 +277 581 → 656 +75
list_tags 2,671 → 2,918 +247 634 → 705 +71
list_tasks 2,245 → 2,508 +263 513 → 586 +73
list_themes 2,563 → 2,818 +255 600 → 671 +71
list_users 2,512 → 2,763 +251 580 → 650 +70
manage_dashboard_certification 1,633 → 1,792 +159 359 → 400 +41
manage_dashboard_owners 1,943 → 2,032 +89 420 → 441 +21
manage_dashboard_roles 1,693 → 1,780 +87 360 → 381 +21
manage_native_filters 5,838 → 6,544 +706 1,228 → 1,438 +210
open_sql_lab_with_context 1,489 → 1,668 +179 319 → 372 +53
query_dataset 3,320 → 3,562 +242 770 → 840 +70
remove_chart_from_dashboard 1,030 → 1,125 +95 216 → 239 +23
restore_chart 892 → 963 +71 195 → 214 +19
restore_dashboard 753 → 832 +79 157 → 176 +19
save_sql_query 1,294 → 1,449 +155 285 → 331 +46
update_chart 104,163 → 53,395 -50,768 25,227 → 12,759 -12,468
update_chart_preview 102,352 → 52,409 -49,943 24,838 → 12,563 -12,275
update_dashboard 3,598 → 3,983 +385 726 → 843 +117
update_dataset_metric 2,477 → 2,972 +495 554 → 688 +134

CI: Re-read the rollup at d6e5bafb: 85 SUCCESS / 10 SKIPPED / 3 NEUTRAL / 0 FAILURE / 0 PENDING. test-load-examples, testcontainers (starrocks, 15), playwright-tests (chromium), babel-extract, and every other Playwright job all passed. Between 25e553307f and that head, only pytest-mark formatting changed; the tiktoken/regex dependency pins did not change. This does not establish the cause of the earlier failures.

The test-only follow-up head 90fe26612e has a new CI run: 3 IN_PROGRESS / 1 PENDING / 28 QUEUED / 3 SKIPPED as of 2026-09-23 15:14 UTC. Those new-head checks are not yet complete.

@bito-code-review

bito-code-review Bot commented Sep 23, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #76f91c

Actionable Suggestions - 0
Additional Suggestions - 1
  • tests/unit_tests/mcp_service/test_tool_inventory.py - 1
    • Unguarded inputSchema access · Line 144-144
      If `_create_search_result_serializer` ever regresses to summary mode, line 144 raises a bare `KeyError` rather than a descriptive failure; `test_tool_inventory_size` asserts key presence (line 125) but this schema-fidelity test does not. Adding the same assert here keeps the failure self-explanatory.
Filtered by Review Rules

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

  • tests/unit_tests/mcp_service/test_tool_inventory.py - 2
Review Details
  • Files reviewed - 1 · Commit Range: d6e5baf..90fe266
    • tests/unit_tests/mcp_service/test_tool_inventory.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 an incremental AI Review.

  • /review full - 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

@gabotorresruiz gabotorresruiz 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.

Hey Amin, thanks for taking this on.

The core change is right, and it fixes more than the size table suggests. On f8f293d2 the compacted chart schemas still carry 62 $ref pointers coming from discriminator.mapping that point at definitions the same pass deleted, and the inlining also dropped default values (get_instance_info loses "default": {} on request). On this branch both are gone, every $ref resolves locally, and the raw tool.parameters that call_tool validates against are byte for byte identical to master for all 72 tools. I am holding at request changes only for the two test infrastructure points I left inline: six budget entries ship with zero headroom and will turn an unrelated docstring edit into a red build, and the token budgets pull a CDN download into tests/unit_tests. Both look cheap to fix and I am happy to dig in with you on either.

What I ran, all on 90fe2661, in a clean 3.11 venv built from requirements/development.txt:

  • pytest tests/unit_tests/mcp_service: 5204 passed, 3 skipped.
  • The three tool execution suites from your testing instructions: 178 passed, matching your number exactly.
  • Your two new test files against f8f293d2: 83 failed, so the new cases really do pin the fix rather than an invariant.
  • Dumped the serialized search entry and the raw parameters for all 72 tools on both commits and diffed them. Descriptions, top level properties, required and additionalProperties are unchanged everywhere, no $defs name collides across the inventory, and there are 0 dangling references on this branch against 62 on f8f293d2.
  • Measured the real search_tools payload shape: five chart tools in one result go from 403,142 to 207,871 bytes, while five list tools go from 18,139 to 19,538. 66 of 72 tools get larger, about 9% in aggregate for the non chart tools, and 4 get much smaller. That trade is clearly worth it for the reference fidelity, but it is the opposite direction from what the description implies, so it may be worth a line there.

CI is fully green on this head, including pre-commit, check-python-deps and python-dependency-liccheck.

Comment thread tests/unit_tests/mcp_service/test_tool_inventory.py Outdated
Comment thread pyproject.toml Outdated
Comment thread docs/admin_docs/configuration/mcp-server.mdx
Comment thread docs/admin_docs/configuration/mcp-server.mdx Outdated
Comment thread superset/mcp_service/server.py
@bito-code-review

bito-code-review Bot commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #5672df

Actionable Suggestions - 0
Additional Suggestions - 2
  • docs/admin_docs/configuration/mcp-server.mdx - 1
    • Doc example contradicts default · Line 777-777
      The table now documents `include_schemas` default as `True`, but the example `MCP_TOOL_SEARCH_CONFIG` block earlier in this file (line 765) still sets `"include_schemas": False`. A user copying that example verbatim gets summary mode, contradicting the documented default. Align the example with the new default.
  • tests/unit_tests/mcp_service/test_tool_inventory.py - 1
    • Duplicated size-check logic · Line 151-154
      This new test re-implements the serialize-and-measure sequence already in `test_tool_inventory_size` (lines 124-129): `_create_search_result_serializer(MCP_TOOL_SEARCH_CONFIG)([tool])[0]`, `json.dumps(..., separators=(",", ":"))`, `len(text.encode("utf-8"))`. If the serializer output or measurement changes, both tests must be updated in lockstep. Consider a shared helper for the byte-measurement step.
Review Details
  • Files reviewed - 8 · Commit Range: 90fe266..b5a91a3
    • docs/admin_docs/configuration/mcp-server.mdx
    • pyproject.toml
    • requirements/development.txt
    • superset/mcp_service/mcp_config.py
    • superset/mcp_service/server.py
    • tests/unit_tests/mcp_service/test_chart_tool_inventory.py
    • tests/unit_tests/mcp_service/test_tool_inventory.py
    • tests/unit_tests/mcp_service/test_tool_search_transform.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 an incremental AI Review.

  • /review full - 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

@gabotorresruiz gabotorresruiz 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.

Amin, thanks for turning both of these around so fast, and for the detail in the replies.

I re-ran the exact probes that produced my change request, and both are genuinely fixed rather than worked around, so I am dismissing it. There is one doc NIT left inline that the Bito run also spotted, and it does not hold up the approval.

What I ran on b5a91a3f:

  • The docstring probe that failed before. Changing Get chart preview by ID or UUID. to Get a chart preview by ID or UUID. now measures 3302 bytes against a 3400 byte budget and test_tool_inventory_size[get_chart_preview] passes. I then measured every entry: minimum slack is exactly 100 bytes, the 68 non chart tools all land between 100 and 199, and the chart caps are untouched (49,531 and 49,230 against 50,000; 53,395 and 52,409 against 55,000).
  • The offline probe. With tiktoken shimmed to raise on import, an empty TIKTOKEN_CACHE_DIR and every proxy variable pointed at a dead port, both inventory files give 155 passed, and the cache directory is still empty afterwards so nothing was fetched. tiktoken and regex are gone from pyproject.toml and the lockfile.
  • The 72 tool dump again. The serialized search entries on this head are byte for byte identical to 90fe2661 for all 72 tools, and the raw tool.parameters are byte for byte identical to f8f293d2, so the _create_search_result_serializer simplification changed nothing a client sees. 0 dangling references here against 62 on f8f293d2.
  • Byte budgets alone still reject the regression. The tokenizer free tests against f8f293d2 give 83 failed, at 97,013 and 104,163 and 96,581 and 102,352 bytes against the 50,000 and 55,000 caps, so removing the token assertions cost no coverage.
  • test_tool_search_transform.py plus both inventory files: 209 passed. The three tool execution suites from your testing instructions: 178 passed. My own full tests/unit_tests/mcp_service run got killed by machine load at 64% with no failures in what ran, so for that one I am leaning on the green unit-tests (current) job rather than claiming a local pass.

CI is green on this head, 46 checks passing and none failing.

Comment thread docs/admin_docs/configuration/mcp-server.mdx Outdated
@bito-code-review

bito-code-review Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #2b8f77

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: b5a91a3..24812ac
    • docs/admin_docs/configuration/mcp-server.mdx
  • Files skipped - 0
  • Tools
    • 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 an incremental AI Review.

  • /review full - 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

CI merges master 96d31ee (apache#44128), whose deleted_state descriptions explain edit/restore eligibility and omitted EXTRA_EDITORS_RESOLVER/guest editorship. These are legitimate caller-facing caveats, not redundant schema expansion, so preserve them rather than trim information to fit a stale budget.

Approved b5a91a3 and head 24812ac both serialize list_charts at 4,946 bytes and list_dashboards at 4,419. The docs-only include_schemas example contributes zero bytes. Master's descriptions grow from 333 to 536 bytes (+203) and 342 to 549 (+207), yielding 5,149 and 4,626 in CI's 8273636 merge.

Raise only these limits to 5,300 and 4,800 using the existing ceil(bytes/100)*100+100 policy. Retain complete-schema parity checks; no production field or description changes.

Validation: MCP unit suite: 5,205 passed, 4 skipped on branch; 5,246 passed, 4 skipped on CI merge tree with this fix. Pre-commit passed for all branch-changed files, including mypy.
@bito-code-review

bito-code-review Bot commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Agent Run #4bd281

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 24812ac..26a6334
    • tests/unit_tests/mcp_service/test_tool_inventory.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 an incremental AI Review.

  • /review full - 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 merged commit 1e08d61 into apache:master Sep 25, 2026
76 checks passed
villebro pushed a commit that referenced this pull request Sep 30, 2026
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
(cherry picked from commit 1e08d61)
villebro added a commit that referenced this pull request Sep 30, 2026
apply_dashboard_filters (#44096) and get_dashboard_data (#44113) were
never backported to 7.0, but the cherry-pick of #44575's tool inventory
test brought in budget entries for them, failing
test_inventory_budgets_cover_every_registered_tool's set-equality
assertion against the registered tools.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

doc Namespace | Anything related to documentation size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants