Skip to content

refactor: remove empty query truncation from MCP server search#2984

Merged
dgageot merged 1 commit into
docker:mainfrom
dgageot:board/4f2c807e3bd1c8d0
Jun 3, 2026
Merged

refactor: remove empty query truncation from MCP server search#2984
dgageot merged 1 commit into
docker:mainfrom
dgageot:board/4f2c807e3bd1c8d0

Conversation

@dgageot
Copy link
Copy Markdown
Member

@dgageot dgageot commented Jun 3, 2026

The search_remote_mcp_servers tool 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.

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.
@dgageot dgageot requested a review from a team as a code owner June 3, 2026 09:13
Copy link
Copy Markdown

@docker-agent docker-agent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@dgageot dgageot merged commit 928a9fa into docker:main Jun 3, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants