(payload: unknown, format?: OutputFormat)
| 36 | } |
| 37 | |
| 38 | function mcpContent(payload: unknown, format?: OutputFormat) { |
| 39 | // MCP spec supports text/image/resource. We encode structured data as a single text block. |
| 40 | // Default is JSON (minified) to reduce tokens; pass format: 'text' for pretty 2-space JSON. |
| 41 | const text = format === 'text' ? JSON.stringify(payload, null, 2) : JSON.stringify(payload); |
| 42 | return [{ type: 'text', text } as any]; |
| 43 | } |
| 44 | |
| 45 | |
| 46 | // Log when server starts |