MCPcopy Index your code
hub / github.com/simstudioai/sim / serializeOutputForFile

Function serializeOutputForFile

apps/sim/lib/copilot/request/tools/files.ts:130–143  ·  view source on GitHub ↗
(output: unknown, format: OutputFormat)

Source from the content-addressed store, hash-verified

128}
129
130export function serializeOutputForFile(output: unknown, format: OutputFormat): string {
131 const unwrapped = unwrapFunctionExecuteOutput(output)
132
133 if (typeof unwrapped === 'string') return unwrapped
134
135 if (format === 'csv') {
136 const rows = extractTabularData(unwrapped)
137 if (rows && rows.length > 0) {
138 return convertRowsToCsv(rows)
139 }
140 }
141
142 return JSON.stringify(unwrapped, null, 2)
143}
144
145export interface OutputFileDeclaration {
146 path: string

Callers 2

files.test.tsFile · 0.90
maybeWriteOutputToFileFunction · 0.85

Calls 3

extractTabularDataFunction · 0.85
convertRowsToCsvFunction · 0.85

Tested by

no test coverage detected