( content: ToolResultBlockParam['content'], )
| 248 | * (images, tool_reference) are treated as non-empty. |
| 249 | */ |
| 250 | export 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. |
no outgoing calls
no test coverage detected