MCPcopy Index your code
hub / github.com/anomalyco/opencode / truncateToolOutput

Function truncateToolOutput

packages/opencode/src/session/message-v2.ts:49–53  ·  view source on GitHub ↗
(text: string, maxChars?: number)

Source from the content-addressed store, hash-verified

47export { isMedia }
48
49function truncateToolOutput(text: string, maxChars?: number) {
50 if (!maxChars || text.length <= maxChars) return text
51 const omitted = text.length - maxChars
52 return `${text.slice(0, maxChars)}\n[Tool output truncated for compaction: omitted ${omitted} chars]`
53}
54
55export const Event = {
56 Updated: SessionV1.Event.MessageUpdated,

Callers 1

message-v2.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected