aminghadersohi opened a new pull request, #44682: URL: https://github.com/apache/superset/pull/44682
### SUMMARY Fixes SC-122300. Promote exact tool-name matches from the caller-visible candidate set ahead of BM25 results, then apply the existing `max_results` budget. Matching case-folds both names and queries, replaces underscores with spaces, and collapses/trims whitespace. Reuse upstream BM25 ranking for remaining results without mutating its limit or changing non-exact queries. Permission and catalog filtering still happen before search; promotion does not consult the full catalog or resurrect cached tools. Pinned `always_visible` tools retain their existing listing behavior. No caller-controlled limit or schema changes. Document the matching rule. ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Not applicable (backend search behavior). Before: eight short peer descriptions mentioning `generate_chart` can exclude the named tool from the top five, especially with a long description. After: the visible exact-name tool is first, with at most five unique results. ### TESTING INSTRUCTIONS - Run `PYTHONPATH=$PWD/superset-core/src:$PWD pytest -q tests/unit_tests/mcp_service/test_tool_search_transform.py tests/unit_tests/mcp_service/test_mcp_server.py tests/unit_tests/mcp_service/test_auth_rbac.py`: **133 passed**. - Added 14 parameterized regression cases: crowded short/long descriptions, case/whitespace/underscore normalization, unchanged non-exact rankings, RBAC-denied and catalog-hidden tools after warming the index, and pinned tools. - `pre-commit run` on the three staged changed files: **passed**, including mypy, formatting, ruff, and pylint. - With BM25 search enabled and `max_results=5`, call `search_tools(query="generate_chart")` as an authorized caller: verify the first result is `generate_chart`. Repeat as a caller without permission: verify that name is absent. Confirm pinned tools remain in `tools/list`. - Deployment/gateway-path checks remain unverified and are deferred until after deployment. ### ADDITIONAL INFORMATION - [x] Has associated issue: SC-122300 - [ ] 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 - [ ] 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]
