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

Function isUnknownToolMessage

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

Source from the content-addressed store, hash-verified

56const escapeRegExp = (value: string): string => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
57
58export 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
66const asProtocolError = (cause: unknown): ProtocolError | undefined => {
67 const sdk = mcpClientSdkIfLoaded();

Callers 2

plugin.tsFile · 0.90
isUnknownToolCauseFunction · 0.85

Calls 1

escapeRegExpFunction · 0.70

Tested by

no test coverage detected