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

Function formatToolContent

web/src/app/api/v1/token-count/_post.ts:477–491  ·  view source on GitHub ↗
(content: any)

Source from the content-addressed store, hash-verified

475}
476
477export function formatToolContent(content: any): string {
478 if (typeof content === 'string') {
479 return content
480 }
481 if (Array.isArray(content)) {
482 return content
483 .map((part) => {
484 if (part.type === 'text') return part.text
485 if (part.type === 'json') return JSON.stringify(part.value)
486 return JSON.stringify(part)
487 })
488 .join('\n')
489 }
490 return JSON.stringify(content)
491}

Callers 3

Calls

no outgoing calls

Tested by

no test coverage detected