MCPcopy
hub / github.com/codeaashu/claude-code / isToolResultContentEmpty

Function isToolResultContentEmpty

src/utils/toolResultStorage.ts:250–265  ·  view source on GitHub ↗
(
  content: ToolResultBlockParam['content'],
)

Source from the content-addressed store, hash-verified

248 * (images, tool_reference) are treated as non-empty.
249 */
250export function isToolResultContentEmpty(
251 content: ToolResultBlockParam['content'],
252): boolean {
253 if (!content) return true
254 if (typeof content === 'string') return content.trim() === ''
255 if (!Array.isArray(content)) return false
256 if (content.length === 0) return true
257 return content.every(
258 block =>
259 typeof block === 'object' &&
260 'type' in block &&
261 block.type === 'text' &&
262 'text' in block &&
263 (typeof block.text !== 'string' || block.text.trim() === ''),
264 )
265}
266
267/**
268 * Handle large tool results by persisting to disk instead of truncating.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected