aminghadersohi opened a new pull request, #38416: URL: https://github.com/apache/superset/pull/38416
## Summary Adds a `popularity_score` computed field to all three MCP list tools (charts, dashboards, datasets) so MCP clients can rank results by relevance. - Scores are computed **lazily** — only when requested via `select_columns` or `order_column` - Supports sorting via `order_column="popularity_score"` using a two-pass approach (fetch IDs → score → sort → paginate → fetch full models) - No performance impact on normal list calls that don't request the field ### Scoring Formulas | Asset | Formula | |-------|---------| | **Charts** | `view_count_30d * 3 + fav_count * 5 + dashboard_count * 2 + is_certified * 10 + recency_bonus` | | **Dashboards** | `view_count_30d * 3 + fav_count * 5 + chart_count * 1 + is_published * 3 + is_certified * 10 + recency_bonus` | | **Datasets** | `chart_count * 3 + is_certified * 10 + recency_bonus` | Recency bonus: +5 if modified in last 7 days, +2 if last 30 days, +0 otherwise. ### Files Changed - **New:** `superset/mcp_service/common/popularity.py` — core scoring module - **New:** `tests/unit_tests/mcp_service/common/test_popularity.py` — 19 unit tests - **Modified:** Chart/Dashboard/Dataset schemas — added `popularity_score` field - **Modified:** `schema_discovery.py` — added popularity_score to sortable/extra columns - **Modified:** List tool files — handle popularity sorting and selection ## Test plan - [x] 19 unit tests covering scoring formulas, recency bonus, two-pass sorting, and edge cases - [ ] Manual verification via MCP: `list_charts(select_columns=["id", "slice_name", "popularity_score"])` - [ ] Manual verification via MCP: `list_charts(order_column="popularity_score", order_direction="desc")` -- 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]
