MCPcopy Index your code
hub / github.com/ChatLab/ChatLab / formatArrayResult

Function formatArrayResult

packages/mcp-server/src/format.ts:208–221  ·  view source on GitHub ↗
(obj: Record<string, unknown>)

Source from the content-addressed store, hash-verified

206}
207
208function formatArrayResult(obj: Record<string, unknown>): string {
209 const lines: string[] = []
210
211 for (const [key, value] of Object.entries(obj)) {
212 if (Array.isArray(value) && value.length > 0 && typeof value[0] === 'string') {
213 if (lines.length > 0) lines.push('')
214 lines.push(...value)
215 } else if (!Array.isArray(value) && value !== undefined && value !== null) {
216 lines.push(`${key}: ${value}`)
217 }
218 }
219
220 return lines.join('\n')
221}
222
223function formatSessionsList(obj: Record<string, unknown>): string {
224 const sessions = obj.sessions as Array<Record<string, unknown>>

Callers 1

formatToolResultAsTextFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected