| 567 | const decodeMcpToolCallEnvelope = Schema.decodeUnknownOption(McpToolCallEnvelope); |
| 568 | |
| 569 | const extractMcpErrorMessage = (content: unknown): string => { |
| 570 | if (Array.isArray(content)) { |
| 571 | for (const item of content) { |
| 572 | const decoded = Option.getOrUndefined(decodeMcpTextContent(item)); |
| 573 | if (decoded !== undefined && decoded.text.length > 0) return decoded.text; |
| 574 | } |
| 575 | } |
| 576 | return "MCP tool returned an error"; |
| 577 | }; |
| 578 | |
| 579 | // The server no longer advertises this tool — the persisted catalog drifted. |
| 580 | // Answered after marking the connection stale so the next tools read re-lists; |