fix(core): isolate invalid tool registrations - #45325
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes
Tool registration now skips and logs invalid entries instead of failing the entire batch. Healthy tools in the same batch are still installed.
MCP tools
Before: All discovered MCP tools in a Location were submitted in one registration batch. One invalid tool or namespace rejected the entire batch, including healthy tools from unrelated servers. On initial registration, the session could proceed without those MCP tools. On later updates, the previous tool set remained, but the registration error terminated the catalog-update listener, so subsequent updates were no longer processed. The MCP servers could still appear connected.
After: Invalid entries are excluded and healthy tools from the same and other servers register successfully. Validation errors no longer terminate reconciliation, so later catalog updates continue to work and corrected tools can become available. The existing all-server batch structure is unchanged.
Plugin tools
Before: An invalid entry rejected the entire tool-registration batch. The plugin host converted that registration error into a defect. If it occurred during plugin setup, setup failed, the plugin scope was cleaned up, and the plugin was marked failed. This could remove its other tools and registrations too.
After: Invalid entries are skipped, healthy tools register, and plugin setup continues. A tool validation error alone no longer marks the plugin failed or cleans up its other registrations. Unexpected setup failures still behave as before.
Validation and reporting
RegistrationErrorremains an internal validation error, but is handled insideTool.transform(). The batch operation no longer returns it to callers, and the MCP/plugin adapters no longer needEffect.orDiefor it.Verification
132 targeted tests passed, covering healthy siblings, rejection logs, collisions, scoped cleanup, MCP catalog updates and recovery, and continued plugin initialization. Core and SDK typechecks and formatting checks passed.
Follow-up to #45317.