(message: string, toolName: string)
| 56 | const escapeRegExp = (value: string): string => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"); |
| 57 | |
| 58 | export const isUnknownToolMessage = (message: string, toolName: string): boolean => { |
| 59 | const name = escapeRegExp(toolName); |
| 60 | return new RegExp( |
| 61 | `(?:unknown tool:?\\s*"?${name}"?|tool\\s+"?${name}"?\\s+(?:not found|is not available|does not exist))`, |
| 62 | "i", |
| 63 | ).test(message); |
| 64 | }; |
| 65 | |
| 66 | const asProtocolError = (cause: unknown): ProtocolError | undefined => { |
| 67 | const sdk = mcpClientSdkIfLoaded(); |
no test coverage detected