justinpark opened a new pull request, #41607:
URL: https://github.com/apache/superset/pull/41607
### SUMMARY
Added a replaces parameter to the @tool decorator in superset-core that
allows extensions to cleanly replace existing host tools under their original
name, without extension namespace prefixing
#### Problem
The original get_instance_info tool was taking ~280 seconds per call. The
bottleneck was security filter subqueries (DashboardAccessFilter, ChartFilter,
etc.) applied to every COUNT(*). Extensions had no clean way to swap out a host
tool — the only option was monkey-patching module globals, which broke silently
when re-exports obscured the target module.
#### Changes
- superset-core/src/superset_core/mcp/decorators.py: added replaces: str |
None = None to the tool() stub signature and docstring
- superset/core/mcp/core_mcp_injection.py:
- Added _resolve_tool_name(base_name, replaces) — returns (replaces,
"host") directly when replacing, bypassing _get_prefixed_id_with_context
entirely since host tool replacement is always a host-context operation
- Added _remove_tool_for_replacement(mcp, name) — removes the original
tool from the FastMCP registry before registering the replacement, with a
warning (not raise) if the tool isn't found
- Added replaces parameter to create_tool_decorator()
### TESTING INSTRUCTIONS
added specs
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
<!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
- [ ] 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
- [ ] 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]