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

Function isUnknownToolMessage

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

Source from the content-addressed store, hash-verified

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

Callers 2

plugin.tsFile · 0.90
isUnknownToolCauseFunction · 0.85

Calls 1

escapeRegExpFunction · 0.70

Tested by

no test coverage detected