MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / formatValueForError

Function formatValueForError

packages/agent-runtime/src/util/format-value.ts:1–10  ·  view source on GitHub ↗
(value: unknown, maxLength = 500)

Source from the content-addressed store, hash-verified

1export function formatValueForError(value: unknown, maxLength = 500): string {
2 const jsonStr = JSON.stringify(value, null, 2) ?? 'undefined'
3 const truncated = jsonStr.length > maxLength
4 ? jsonStr.slice(0, maxLength) + '...(truncated)'
5 : jsonStr
6 if (value === null || value === undefined || typeof value !== 'object') {
7 return `${truncated} (type: ${value === null ? 'null' : typeof value})`
8 }
9 return truncated
10}

Callers 4

executeToolCallFunction · 0.90
executeCustomToolCallFunction · 0.90
set-output.tsFile · 0.90
validateAgentInputFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected