Repository navigation
improvement(search): return a longer live read window when an MCP client asks for more chunks - #9823
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
[Medium impact] The PR appears safe to merge. SummarySearch MCP reads can return longer windows when clients request a
Reviews (5) · Last reviewed commit: "improvement(search): size a scaled read ..." · Reviewed by Greptile |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
There was a problem hiding this comment.
All reported issues were addressed across 4 files
Reply with feedback, questions, or to request a fix.
Turn on auto-fix | Re-trigger cubic
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
…ent asks for more chunks
…of a scaled read call
65f7696 to
1d17e0a
Compare
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
@cubic-dev-ai review this PR |
@waleedlatif1 I have started the AI code review. It will take a few minutes to complete. |
|
Final bench on this exact head (00432f3) vs its staging base, MCP client bench (Sonnet 5.5, 83 cases, 4 attempts per case per side, pooled):
An earlier round on the per-document version (before the call budget and encoded sizing) showed continuation reads 25 → 12 with quality inside the same-code spread. |
Summary
read_documentreturned the same 8,000-character window whateverlimita client asked for, and clients that asked for more chunks then spent extra calls continuing withstartOffsetlimitabove the default (3) now returns a proportionally longer window:limit: 8returns up to 21,333 characters, andnext.startOffsetcontinues from where it endedlimit: 8reads 21,333 for one document, 20,000 each for two, 13,333 for three, 10,000 for four, and 8,000 (today's window) for five or more. A call's result then stays under the 50,000-character size at which MCP clients such as Claude Code save a tool result to a file instead of showing it, and no call returns more per document than it does today once five or more documents are readType of Change
Testing
lib/sim-search/live/application.test.ts(a scaling caller above the default limit gets the longer window and continues from its end; one call's documents share the budget at 2, 3 and 4 documents; at or below the default, at five or ten documents, and for a caller that does not scale, the window stays 8,000; a document made entirely of quotes stays within its encoded share and never below 8,000) andlib/knowledge/mcp/server.protocol.test.ts(the MCP adapter opts in with the call's document count, for a single and a batch read); each was seen failing without the change, and each guard (budget, encoded size, 8,000 floor, document count) was reverted and seen failingbunx vitest run lib/sim-search/live lib/knowledge/mcp(515 passed), biome on changed files; type-check and audits in CIChecklist
test-auditauthoring gate)🤖 Generated with Claude Code