You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature: defer MCP tool schemas (tool search) instead of sending all 420 of them on every request
#11285
DSH Desktop 0.2.1-rc.2 sends every MCP tool definition on every request. It is not filtered, summarised, or deferred — the tool array in request/header is byte-for-byte the union of all connected servers' tools/list results.
Measured on a real session with rea + cua-driver + github MCP servers attached:
source
tools
bytes
≈tokens
mcp:rea
207
774,808
≈204k
mcp:cua-driver
60
127,451
≈34k
built-in
110
84,652
≈22k
mcp:github
43
47,413
≈12k
total
420
1,034,745
≈272k
One single tool (rea.compare_web_captures) is 166 KB ≈ 44k tokens by itself.
Why it matters
Hard failure on smaller windows. On any model with < ~300k context the payload alone exceeds the window. The downstream host then tries to compact the conversation (it has no way to drop tools), which cannot help, and it loops: a fresh part every 15–20 s. We hit 164→175 parts before switching models; diagnostics repeated handoff note ... failed past the hard line 162 times in 12 minutes. Reported from the host side in Unbounded part-switching on deterministic model failure (missing/invalid credential) ends in V8 OOM Fei2411/DS-Bot#485 (unbounded part-switching), but the root cause is here.
Cost and accuracy on large windows. Even at 1M context it is 27% of every request, and tool-selection accuracy is known to degrade past ~30–50 tools. Claude Code's docs put 50 tools at 10–20k tokens and call out the accuracy cliff.
Precedent
Claude Code: tool search is on by default — definitions are withheld, the model gets a summary and searches, ≤5 tools loaded per search, up to 10k tools in the catalog. ENABLE_TOOL_SEARCH=auto[.N] activates once deferrable definitions reach 10% of the window.
Codex: MCP tools are deferred behind tool_search as well.
Notably, the vendored provider SDK already inside DSH carries the plumbing (defer_loading, tool_search_output, the supportsToolSearch compat flag — the latter currently only used for OpenAI Responses' additive tool updates). The agent loop never withholds schemas, and there is no config switch to opt in.
Ask
Deferred tool loading with an automatic threshold (Claude Code's auto semantics would already cover this case: 272k / 1M = 27% ≫ 10%).
A per-session or per-Bot MCP scope — e.g. attach rea only to a "reverse-engineering" preset instead of every session. Today MCP servers are profile-global, so a heavy server taxes every Bot.
A visible tool budget guard — surface "tools ≈X tokens / window Y" and refuse to start a turn when tools alone exceed a ratio of the window, instead of silently entering compaction loops.
Option 2 alone would have prevented our incident; option 1 is the general fix.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
What happens today
DSH Desktop 0.2.1-rc.2 sends every MCP tool definition on every request. It is not filtered, summarised, or deferred — the tool array in
request/headeris byte-for-byte the union of all connected servers'tools/listresults.Measured on a real session with
rea+cua-driver+githubMCP servers attached:One single tool (
rea.compare_web_captures) is 166 KB ≈ 44k tokens by itself.Why it matters
handoff note ... failed past the hard line162 times in 12 minutes. Reported from the host side in Unbounded part-switching on deterministic model failure (missing/invalid credential) ends in V8 OOM Fei2411/DS-Bot#485 (unbounded part-switching), but the root cause is here.Precedent
ENABLE_TOOL_SEARCH=auto[.N]activates once deferrable definitions reach 10% of the window.tool_searchas well.Notably, the vendored provider SDK already inside DSH carries the plumbing (
defer_loading,tool_search_output, thesupportsToolSearchcompat flag — the latter currently only used for OpenAI Responses' additive tool updates). The agent loop never withholds schemas, and there is no config switch to opt in.Ask
autosemantics would already cover this case: 272k / 1M = 27% ≫ 10%).reaonly to a "reverse-engineering" preset instead of every session. Today MCP servers are profile-global, so a heavy server taxes every Bot.Option 2 alone would have prevented our incident; option 1 is the general fix.
All reactions