MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / contentSize

Function contentSize

source code/utils/toolResultStorage.ts:520–531  ·  view source on GitHub ↗
(
  content: NonNullable<ToolResultBlockParam['content']>,
)

Source from the content-addressed store, hash-verified

518}
519
520function contentSize(
521 content: NonNullable<ToolResultBlockParam['content']>,
522): number {
523 if (typeof content === 'string') return content.length
524 // Sum text-block lengths directly. Slightly under-counts vs serialized
525 // (no JSON framing), but the budget is a rough token heuristic anyway.
526 // Avoids allocating a content-sized string every enforcement pass.
527 return content.reduce(
528 (sum, b) => sum + (b.type === 'text' ? b.text.length : 0),
529 0,
530 )
531}
532
533/**
534 * Walk messages and build tool_use_id → tool_name from assistant tool_use

Callers 2

Calls

no outgoing calls

Tested by

no test coverage detected