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

Function isUnknownToolMessage

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

Source from the content-addressed store, hash-verified

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