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

Function isUnknownToolCause

packages/plugins/mcp/src/sdk/invoke.ts:73–84  ·  view source on GitHub ↗
(cause: unknown, toolName: string)

Source from the content-addressed store, hash-verified

71};
72
73const isUnknownToolCause = (cause: unknown, toolName: string): boolean => {
74 const sdk = mcpClientSdkIfLoaded();
75 const protocolError = asProtocolError(cause);
76 return (
77 sdk !== undefined &&
78 protocolError !== undefined &&
79 (protocolError.code === sdk.client.ProtocolErrorCode.InvalidParams ||
80 protocolError.code === sdk.client.ProtocolErrorCode.MethodNotFound) &&
81 // oxlint-disable-next-line executor/no-unknown-error-message -- boundary: the narrowing above reaches the SDK's ProtocolError, whose message carries the only unknown-tool discriminator the protocol provides
82 isUnknownToolMessage(protocolError.message, toolName)
83 );
84};
85
86// ---------------------------------------------------------------------------
87// Elicitation bridge — decode incoming MCP ElicitRequest, route through

Callers 1

useConnectionFunction · 0.85

Calls 3

mcpClientSdkIfLoadedFunction · 0.90
asProtocolErrorFunction · 0.85
isUnknownToolMessageFunction · 0.85

Tested by

no test coverage detected