Repository navigation
Conversation
Author
|
Closing: the bench may move off pi. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
pi cuts the model-facing text of every MCP tool result at a fixed 20KB and saves the full text to a file the model is told to read with offset/limit. Without a tool that can read files, the model never sees the middle.
Example: a session started with
--no-builtin-toolsand only an MCP server's tools. A tool that lists a browser page's site tools returns about 43KB (10.9k tokens) for four tools. The model gets the start and end of that list. In the cut-out middle are the names and refs it needs to call those tools. It cannot open the saved file, so it re-lists the tools, gets the same cut list, and falls back to other tools.Change
MCP servers accept
maxOutputBytesinmcp.json: the bytes of tool-result text the model sees before the middle is cut. The default stays 20480.{ "mcpServers": { "browser": { "url": "https://example.com/mcp", "maxOutputBytes": 65536 } } }validateMcpServerConfigrejects values that are not positive integers.createMcpToolDefinitionpasses the value toconvertMcpResult, which passes it tolimitMcpContent.read_mcp_resourceand the resource list tools keep the 20KB default.docs/mcp.mdlists the key.Testing
test/mcp-extension.test.ts: 29 pass. New tests:0and1.5.maxOutputBytes: 65536returns 28KB of text whole. With the limit ignored, this test fails.convertMcpResultwithmaxOutputBytes: 1024cuts to about 1KB.npm run check: biome passes.tscerrors only on the generated model data, which this checkout does not have, and reports nothing in the changed files.