Repository navigation
fix: hide inactive tools in MCP settings - #8206
Merged
Merged
Conversation
shaohuzhang1
commented
Nov 27, 2026
| mcpOptions.value = tools.filter((item) => item.is_active) | ||
| emit('loaded', tools) | ||
| }) | ||
| .finally(() => { |
Contributor
Author
There was a problem hiding this comment.
Here's my review of the diff:
The change: Filters tools to only include active ones (item.is_active) before assigning to mcpOptions, while still emitting the full unfiltered tools.
Potential Issues
-
Inconsistency between
mcpOptionsand emitted datamcpOptions.valuereceives only active tools.emit('loaded', tools)emits the full list (including inactive tools).- If a parent component uses the emitted
toolsto make assumptions matchingmcpOptions, they will diverge. Confirm this divergence is intentional.
-
Falsy filter risk on
is_active- If
is_activecan beundefinedor a non-boolean (e.g.,0,"false"string,null), the filter may unexpectedly drop valid entries. - Consider explicit check:
tools.filter((item) => item.is_active === true)if strict boolean is expected.
- If
-
Empty result handling
- If all tools are inactive,
mcpOptionsbecomes[]. Ensure downstream code handles an empty options list gracefully (e.g., no MCP selector shown, no crash).
- If all tools are inactive,
-
No null/undefined guard on
tools.then((tools) => ...)assumesgetToolListWithSharedalways resolves to an array. Add a defensive check:Array.isArray(tools) ? tools.filter(...) : [].
-
Visibility race condition (pre-existing, but relevant)
if (!visible.value) returncorrectly guards assignment. However, thefinallyblock still runs — verify nothing infinallydepends onmcpOptionsbeing populated, since it may not be.
Optimization Suggestions
- Compute once from the same source for clarity:
const activeTools = tools.filter((item) => item.is_active === true) mcpOptions.value = activeTools emit('loaded', tools)
- Emit both sets if consumers need them, e.g.
emit('loaded', { all: tools, active: activeTools }), to prevent ambiguity. - Type safety: ensure
McpOptiontype marksis_activeasboolean(not optional) so the filter logic is self-documenting.
Summary
The change itself is syntactically fine, but watch for (a) mismatch between filtered mcpOptions and unfiltered emitted tools, (b) loose truthiness on is_active, and (c) missing array/null guards.
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.
fix: hide inactive tools in MCP settings