---
source: https://iinventedlight.com/library/notes/ao-tool-result-truncation.md
title: "Gemini CLI and OpenCode cap tool result size before it fills the context"
license: CC-BY-4.0
license_url: https://creativecommons.org/licenses/by/4.0/
source_license: "Apache-2.0 (google-gemini/gemini-cli (GitHub)); MIT (anomalyco/opencode (GitHub)); prose restates cited source lines in own words"
license_family: mixed-green
attribution: "Summary by iinventedlight (AI-assisted). Sources: google-gemini/gemini-cli (GitHub), Gemini CLI settings, Apache-2.0 (https://raw.githubusercontent.com/google-gemini/gemini-cli/main/LICENSE). Copyright (c) Google LLC; anomalyco/opencode (GitHub), Configuration (OpenCode docs), MIT (https://raw.githubusercontent.com/anomalyco/opencode/dev/LICENSE). Copyright (c) 2025 opencode."
author: "iinventedlight (synthesis of cited sources); text drafted with AI assistance"
date: 2026-11-16
status: published
approved_by: "Cole Withington, 2026-11-20 13:14 PT: \"Publish the full batch and rewrite the 6 live notes\""
checked_on: 2026-11-16
as_of: 2026-11-16
confidence: medium
untested: "Not reproduced (2026-11-16). Official docs and source files were read; no client, server, or agent was run for this note."
category: agent-operations
topic_area: "agent operations: tool result truncation"
tags: [truncation, tool-output, gemini-cli, opencode]
client: Librarian
sources:
  - id: S1
    title: "Gemini CLI settings"
    publisher: google-gemini/gemini-cli (GitHub)
    url: https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/settings.md
    accessed: 2026-11-16
    license: "Apache-2.0"
  - id: S2
    title: "Configuration (OpenCode docs)"
    publisher: anomalyco/opencode (GitHub)
    url: https://github.com/anomalyco/opencode/blob/dev/services/site/src/docs/content/config.mdx
    accessed: 2026-11-16
    license: "MIT"
---
# Gemini CLI and OpenCode cap tool result size before it fills the context
**Answer:** Large tool outputs can be truncated.

## Gemini CLI

The tools.truncateToolOutputThreshold setting is the maximum characters to show when truncating large tool outputs. The default is 40000. Set to 0 or negative to disable truncation.

## OpenCode

Set the maximum number of lines and bytes retained from a tool result. The example config uses tool_output with max_lines 2000 and max_bytes 51200.

## See also

- [ao-subagent-delegation](https://iinventedlight.com/library/notes/ao-subagent-delegation/)
- [ao-mcp-pagination](https://iinventedlight.com/library/notes/ao-mcp-pagination/)

## Claims

- id: C1
  claim: Gemini CLI names the setting tools.truncateToolOutputThreshold.
  source: S1
  evidence: "`tools.truncateToolOutputThreshold`"

- id: C2
  claim: The default threshold is 40000 characters.
  source: S1
  evidence: "Set to 0 or negative to disable truncation"

- id: C3
  claim: OpenCode has a tool_output configuration object.
  source: S2
  evidence: "\"tool_output\": {"

- id: C4
  claim: The documented example keeps 2000 lines and 51200 bytes.
  source: S2
  evidence: "\"max_lines\": 2000,"

## Sources

- [S1] Gemini CLI settings. google-gemini/gemini-cli (GitHub). https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/settings.md . License: Apache-2.0. Accessed 2026-11-16.

- [S2] Configuration (OpenCode docs). anomalyco/opencode (GitHub). https://github.com/anomalyco/opencode/blob/dev/services/site/src/docs/content/config.mdx . License: MIT. Accessed 2026-11-16.

License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: google-gemini/gemini-cli (GitHub), Gemini CLI settings, Apache-2.0 (https://raw.githubusercontent.com/google-gemini/gemini-cli/main/LICENSE). Copyright (c) Google LLC; anomalyco/opencode (GitHub), Configuration (OpenCode docs), MIT (https://raw.githubusercontent.com/anomalyco/opencode/dev/LICENSE). Copyright (c) 2025 opencode. Text was condensed and changed from the originals.

---

Agents: [/agents.md](/agents.md) | [/.well-known/agent-library.json](/.well-known/agent-library.json).
