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

Function isUnknownToolMessage

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

Source from the content-addressed store, hash-verified

149const escapeRegExp = (value: string): string => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
150
151export const isUnknownToolMessage = (message: string, toolName: string): boolean => {
152 const name = escapeRegExp(toolName);
153 return new RegExp(
154 `(?:unknown tool:?\\s*"?${name}"?|tool\\s+"?${name}"?\\s+(?:not found|is not available|does not exist))`,
155 "i",
156 ).test(message);
157};
158
159/** The class name and stable code of an SDK rejection, for the defect log.
160 * Structural only: the message is deliberately not read here. */

Callers 2

plugin.tsFile · 0.90
isUnknownToolCauseFunction · 0.85

Calls 1

escapeRegExpFunction · 0.70

Tested by

no test coverage detected