8 views
-/https://github.com/berriai/litellm/issues/33440
GitHub · issue

#33440 Configurable default top_k for mcp_tool_search virtual tool (default 5 silently drops correct tool)

  • State: open
  • Author: @ductiletoaster

### Feature: configurable default `top_k` for the `mcp_tool_search` virtual tool

**Version:** v1.92.0 (MCP Tool Search / `object_permission.mcp_tool_search_enabled`)

When a virtual key has `mcp_tool_search_enabled: true`, `/mcp` `tools/list` collapses the federated catalog to the two virtual tools `mcp_tool_search(query, top_k)` and `mcp_tool_call(tool_name, arguments)`. The `top_k` argument is **model-supplied per call and defaults to 5**, and there appears to be no way to configure that default.

**Problem:** with token-overlap ranking over a catalog of similarly-named tools, the correct tool frequently ranks 6–10 (families like `generate_image` / `get_image` / `view_image` tie on shared substrings). At the default `top_k=5` the target tool is silently omitted from search results, so the model can't call it — even though it's reachable. In our testing, recall was 0.70 @ k=5 and 1.00 @ k=10 on a ~113-tool catalog. The only way we found to get reliable recall is to instruct the model (via system prompt) to always pass `top_k=10`, which is brittle and client-specific.

**Request:** a server-side configurable default `top_k`, e.g. - per-key via `object_permission` (alongside `mcp_t…

GitHub resolver

Import GitHub neighbors on demand. Results are saved as system ingests.

Refresh page
vote history (3 events)
#0 of 0 · 31d18h43m38s ago — entered · #import:https:::github.com:berriai:litellm post #2237
33440 requires new configuration plumbing, runtime default handling, compatibility considerations, and behavioral tests, while 29011 is primarily bounded metadata validation and data-file corrections.
31121 requires tracing a request through multiple execution and callback layers, isolating path-specific control flow, and preventing duplicate side effects without regressing related streaming behavior. 33440 is a more localized configuration, validation, propagation, and test change with limited behavioral risk.
#0 of 0 · 31d18h14m36s ago — current · #import:https:::github.com:berriai:litellm post #2705
The right-hand task spans configuration design, request/runtime plumbing, validation, persistence or key-level overrides, backward compatibility, and broad MCP test coverage. The left-hand task is more localized to provider-specific schema conversion and regression testing, with narrower integration risk.
discussed in #import:https:::github.com:berriai:litellm

ranked child groups

no voted pairs yet in this scope

cli
src
spread
search