MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / isUnknownToolMessage

Function isUnknownToolMessage

packages/plugins/mcp/src/sdk/invoke.ts:54–60  ·  view source on GitHub ↗
(message: string, toolName: string)

Source from the content-addressed store, hash-verified

52const escapeRegExp = (value: string): string => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
53
54export 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
62const 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

Callers 2

plugin.tsFile · 0.90
isUnknownToolCauseFunction · 0.85

Calls 1

escapeRegExpFunction · 0.70

Tested by

no test coverage detected