(toolName: string, error: unknown)
| 177 | return 'Unknown error occurred.' |
| 178 | } |
| 179 | |
| 180 | function createToolErrorResponse(toolName: string, error: unknown): CallToolResult { |
| 181 | const message = extractToolErrorMessage(error) |
| 182 | const code = extractToolErrorCode(error) |
| 183 | const codeLabel = code ? ` [${code}]` : '' |
| 184 | const troubleshooting = buildTroubleshootingText(code, message) |
| 185 | |
| 186 | return { |
| 187 | isError: true, |
| 188 | content: [ |
| 189 | { |
| 190 | type: 'text' as const, |
| 191 | text: `Tool "${toolName}" failed${codeLabel}: ${message}${troubleshooting}` |
| 192 | } |
| 193 | ] |
| 194 | } |
| 195 | } |
| 196 | |
| 197 | function buildTroubleshootingText(code: TempadMcpErrorCode | undefined, message: string): string { |
no test coverage detected