openwiki_begin results routinely exceed 100k characters with no pagination or capping
What happened
Consuming openwiki_begin as an MCP tool client (Claude Code, [email protected]), the returned
ActiveBeginView result exceeded 100,000 characters in a real repository run. Two separate openwiki_begin calls in one session both blew
past that size. The client had to save the raw result to a file and probe it with jq just to
read status/phase/runId — the fields actually needed to decide the next call — because
reading the result inline consumed an unreasonable share of the context budget.
Looking at ActiveBeginView (dist/generation/repository-run.d.ts), the likely size drivers are
the changedPaths: string[] field and the pageUpdateWindows: RepositoryPageUpdateWindow[]
array, each entry of which nests its own changedPaths and pages arrays, plus claimIssues.
On a repository with a meaningful amount of drift since the last successful run, these can list
every changed path and every page's baseline window in full, with no cap and no pagination.
Why this is a problem
MCP tool results are consumed directly by a language model's context window, not by a program that can lazily stream or discard unused fields. A result 100k+ characters long is roughly 25,000+ tokens for a single tool call — enough to noticeably eat into a single turn's budget before the model has done any actual work. This is a known, live concern in the MCP ecosystem generally, not something specific to this client:
- The MCP spec's own pagination page
(https://modelcontextprotocol.io/specification/2025-06-18/server/utilities/pagination) defines
cursor-based pagination so that "servers [can] yield results in smaller chunks rather than all
at once", noting it is "useful for local integrations to avoid performance issues with large
data sets" — currently scoped
to
resources/list,resources/templates/list,prompts/list, andtools/list, but the same rationale applies directly to a single largetools/callresult like this one. - The MCP Tools spec page (https://modelcontextprotocol.io/specification/2025-06-18/server/tools) requires servers to "sanitize tool outputs" under Security Considerations, and its own worked examples return small, purpose-built text/structured payloads rather than dumping full internal state.
- The protocol maintainers' own discussion, "Response size limit for MCP responses to prevent context overflow in AI Agents" (https://github.com/modelcontextprotocol/modelcontextprotocol/discussions/2211), documents this exact failure mode elsewhere (e.g. browser-automation tools returning 50k-500k tokens per call) and lays out the emerging norms: paginate stateless queries, spill large payloads to disk with a reference instead of inlining them, return deltas rather than full state on repeat calls, and let the client negotiate a size budget rather than receiving an unbounded blob.
Suggested direction
openwiki_begin doesn't need to return every changed path and every page's full update window
inline every time — a lean summary (counts, plus maybe the first N paths) with a way to fetch the
full list on demand (a follow-up call, or a resource_link the host can read only if it actually
needs the full detail) would keep the common case — "what's the status and runId" — cheap, while
still making the full detail available for a host that wants it.
Environment
[email protected](npm)- MCP client: Claude Code
- Reproducible on: any repository with enough source drift since the last successful
openwikirun to populatechangedPaths/pageUpdateWindowswith many entries
Source: langchain-ai/openwiki