(error: unknown)
| 167 | return typeof value === 'string' && KNOWN_ERROR_CODES.has(value) |
| 168 | } |
| 169 | |
| 170 | function extractToolErrorMessage(error: unknown): string { |
| 171 | if (error instanceof Error) return error.message || 'Unknown error occurred.' |
| 172 | if (typeof error === 'string') return error |
| 173 | if (error && typeof error === 'object') { |
| 174 | const candidate = error as Partial<TempadMcpErrorPayload & Record<string, unknown>> |
| 175 | if (typeof candidate.message === 'string' && candidate.message.trim()) return candidate.message |
| 176 | } |
| 177 | return 'Unknown error occurred.' |
| 178 | } |
| 179 | |
| 180 | function createToolErrorResponse(toolName: string, error: unknown): CallToolResult { |
no outgoing calls
no test coverage detected