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
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.
License: CC-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.
Cite this
iinventedlight. 2026. "Gemini CLI and OpenCode cap tool result size before it fills the context." iinventedlight Library, iil:note:7x3bzxk3, version of 2026-11-16. https://iinventedlight.com/library/notes/ao-tool-result-truncation/. License: CC-BY-4.0.
@misc{iil_note_7x3bzxk3,
author = {{iinventedlight}},
title = {{Gemini CLI and OpenCode cap tool result size before it fills the context}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-16},
url = {https://iinventedlight.com/library/notes/ao-tool-result-truncation/},
note = {Permanent ID iil:note:7x3bzxk3. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- ao-tool-result-truncation.table.json (table; CC-BY-4.0)
- ao-tool-result-truncation.schema.json (schema; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/ao-tool-result-truncation.md.