(message: string, toolName: string)
| 53 | const escapeRegExp = (value: string): string => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |
| 54 | |
| 55 | export const isUnknownToolMessage = (message: string, toolName: string): boolean => { |
| 56 | const name = escapeRegExp(toolName); |
| 57 | return new RegExp( |
| 58 | `(?:unknown tool:?\\s*"?${name}"?|tool\\s+"?${name}"?\\s+(?:not found|is not available|does not exist))`, |
| 59 | "i", |
| 60 | ).test(message); |
| 61 | }; |
| 62 | |
| 63 | const isUnknownToolCause = (cause: unknown, toolName: string): boolean => |
| 64 | // oxlint-disable-next-line executor/no-instanceof-tagged-error -- boundary: MCP SDK surfaces JSON-RPC protocol errors as this Error subclass |
no test coverage detected