refactor: remove empty query truncation from MCP server search#2984
Merged
Conversation
Remove the emptyQuerySearchLimit constant and its associated truncation logic from search_remote_mcp_servers. The tool now returns all matching servers for any query, including empty queries.
docker-agent
reviewed
Jun 3, 2026
docker-agent
left a comment
There was a problem hiding this comment.
Assessment: 🟢 APPROVE
The refactor cleanly removes the emptyQuerySearchLimit = 25 truncation constant and all associated branching logic. The updated result path is correct — len(matches) is used after the sort, which is the right value now that no slicing occurs. The test update is well-structured: it asserts the returned count equals ts.catalog.Count (the full catalog), which is a stronger invariant than the old fixed-length check.
No bugs, regressions, or logic errors found in the changed lines.
trungutt
approved these changes
Jun 3, 2026
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.
The
search_remote_mcp_serverstool truncated results for empty queries to 25 servers, ostensibly to avoid bloating the LLM's context window. In practice, this hides relevant servers and requires users to already know keywords to discover them.This change removes the truncation logic entirely. An empty query now returns all matching servers from the catalog. Models can still make intelligent choices about how many results to present to a user, and they're not artificially blinded by the tool's limits.
The test expectations were updated accordingly.