(message: string, toolName: string)
| 52 | const escapeRegExp = (value: string): string => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |
| 53 | |
| 54 | export const isUnknownToolMessage = (message: string, toolName: string): boolean => { |
| 55 | const name = escapeRegExp(toolName); |
| 56 | return new RegExp( |
| 57 | `(?:unknown tool:?\\s*"?${name}"?|tool\\s+"?${name}"?\\s+(?:not found|is not available|does not exist))`, |
| 58 | "i", |
| 59 | ).test(message); |
| 60 | }; |
| 61 | |
| 62 | const isUnknownToolCause = (cause: unknown, toolName: string): boolean => |
| 63 | // 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