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

Function httpRefusal

packages/plugins/mcp/src/sdk/invoke.ts:172–181  ·  view source on GitHub ↗
(
  status: number | undefined,
  cause: unknown,
)

Source from the content-addressed store, hash-verified

170 * — not a dead transport. 401/403 keep their auth classification; 5xx and
171 * bodyless 4xx stay opaque, since there is nothing the caller can act on. */
172const httpRefusal = (
173 status: number | undefined,
174 cause: unknown,
175): { readonly httpRefusal: { readonly status: number; readonly message: string } } | {} => {
176 if (status === undefined || status < 400 || status >= 500 || status === 401 || status === 403) {
177 return {};
178 }
179 const message = httpRefusalMessageFromCause(cause);
180 return message === undefined ? {} : { httpRefusal: { status, message } };
181};
182
183const asProtocolError = (cause: unknown): ProtocolError | undefined => {
184 const sdk = mcpClientSdkIfLoaded();

Callers 1

useConnectionFunction · 0.85

Calls 1

Tested by

no test coverage detected