ToolSearch keyword search misses relevant tools when server name prefix dominates query

Resolved 💬 4 comments Opened Mar 3, 2026 by kevin-orellana Closed Apr 16, 2026

Bug Description

When using ToolSearch with keyword queries that include a long MCP server name prefix, the BM25 ranking misses relevant tools. The server name tokens dominate the scoring and crowd out the actual capability keywords.

Reproduction

MCP server: amazon-bedrock-agentcore-browser-mcp (25 tools with names like browser_navigate, browser_evaluate, browser_snapshot, etc.)

Query: +amazon-bedrock-agentcore-browser-mcp navigate evaluate

Expected: Returns browser_navigate and browser_evaluate (both match keywords)

Actual: Returns browser_navigate and browser_navigate_back but misses browser_evaluate. The word "navigate" appears in two tool names so both rank higher than browser_evaluate, and the result limit (5) cuts off before browser_evaluate is reached.

Impact

Users must make a second ToolSearch call with select: to load the missed tool, doubling the tool calls needed. This is especially painful with long server name prefixes where the required +prefix consumes most of the query's keyword budget.

Suggested Fix

When using the + prefix match, the prefix should filter candidate tools but not contribute to relevance scoring. Only the remaining keywords (after the + prefix) should be used for BM25 ranking. This way +amazon-bedrock-agentcore-browser-mcp navigate evaluate would:

  1. Filter to tools from that server (prefix match)
  2. Rank by relevance to "navigate" and "evaluate" (BM25 on remaining keywords)
  3. Return tools matching both keywords before tools matching only one

Workaround

Use select: with exact tool names instead of keyword search.

Environment

  • Claude Code CLI
  • MCP server with 25+ deferred tools

View original on GitHub ↗

This issue has 4 comments on GitHub. Read the full discussion on GitHub ↗