(result: ToolResponse)
| 22 | const logger = createLogger('PiSimTools') |
| 23 | |
| 24 | function toToolResult(result: ToolResponse): PiToolResult { |
| 25 | if (result.success) { |
| 26 | const text = |
| 27 | typeof result.output === 'string' ? result.output : JSON.stringify(result.output ?? {}) |
| 28 | return { text, isError: false } |
| 29 | } |
| 30 | return { text: result.error || 'Tool execution failed', isError: true } |
| 31 | } |
| 32 | |
| 33 | /** |
| 34 | * Builds the Sim tool specs exposed to Pi for a local run. Only tools the user |