Problem
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
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.
Parent tracking issue: #648
Problem
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.
tool_use_id, error state, and valid tool call/result ordering.Acceptance criteria
Out of scope
read_filebudgetingEstimate
1 story point. Independently mergeable and non-stacked.
Parent tracking issue: #648