MCPcopy Index your code
hub / github.com/deepnote/deepnote / formatOutput

Function formatOutput

packages/mcp/src/utils.ts:22–35  ·  view source on GitHub ↗
(data: Record<string, unknown>, compact: boolean)

Source from the content-addressed store, hash-verified

20 * Format output based on compact mode - omit null/empty, use single-line JSON
21 */
22export function formatOutput(data: Record<string, unknown>, compact: boolean): string {
23 if (compact) {
24 const filtered = Object.fromEntries(
25 Object.entries(data).filter(([_, v]: [string, unknown]) => {
26 if (v == null) return false
27 if (Array.isArray(v) && v.length === 0) return false
28 if (typeof v === 'object' && v !== null && !Array.isArray(v) && Object.keys(v).length === 0) return false
29 return true
30 })
31 )
32 return JSON.stringify(filtered)
33 }
34 return JSON.stringify(data, null, 2)
35}
36
37export function isPythonBuiltin(name: string): boolean {
38 return PYTHON_BUILTINS.has(name)

Callers 2

handleReadFunction · 0.85
handleRunFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected