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
[BUG] Bound MCP tool results before adding them to model history #1253
MCP servers can return arbitrarily large text payloads. Zoo Code currently allows those payloads to enter model-facing API history unchanged, so a single Git, browser, or other MCP result can exceed the context window and make condensation fail. This is the original failure reported in #648.
Scope
Bound MCP text results before they are added to model-facing history.
Apply a provider-agnostic model-facing size/token ceiling to MCP string and text-block results.
Preserve tool_use_id, error state, and valid tool call/result ordering.
Leave image and other non-text content behavior unchanged unless required to preserve a valid result shape.
Add a clear truncation marker containing the original and retained size.
Keep this change independent of future full-output storage or MCP resource-link support.
Acceptance criteria
A multi-megabyte MCP text result is bounded before the next model request.
Mixed MCP content retains valid non-text blocks and bounded text blocks.
Truncation preserves tool identifiers and provider-valid tool pairing.
Error results remain errors after truncation.
Focused tests cover string, structured text-block, mixed-content, and error results.
Out of scope
Native read_file budgeting
Condensation-input sanitization
Sliding-window recovery behavior
Full-output spill files or resource references
Aggregate budgeting across parallel tool calls
Estimate
1 story point. Independently mergeable and non-stacked.
Activity