MCPcopy
hub / github.com/claude-code-best/claude-code / coerceToolContentToString

Function coerceToolContentToString

src/utils/queryHelpers.ts:48–53  ·  view source on GitHub ↗

Transcript JSON may deserialize Write tool `content` as a nested object — LRU needs strings.

(value: unknown)

Source from the content-addressed store, hash-verified

46
47/** Transcript JSON may deserialize Write tool `content` as a nested object — LRU needs strings. */
48function coerceToolContentToString(value: unknown): string {
49 if (typeof value === 'string') return value
50 if (value === null || value === undefined) return ''
51 if (typeof value === 'object') return JSON.stringify(value)
52 return String(value)
53}
54
55/**
56 * Checks if the result should be considered successful based on the last message.

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected