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

Function preInitializeMethodNotFound

packages/hosts/mcp/src/envelope.ts:216–226  ·  view source on GitHub ↗
(request: Request)

Source from the content-addressed store, hash-verified

214 * Reads a clone, leaving the caller's request body intact for the transport.
215 */
216export const preInitializeMethodNotFound = (request: Request): Effect.Effect<Response | null> =>
217 request.method !== "POST" || !passesTransportContentNegotiation(request)
218 ? Effect.succeed(null)
219 : Effect.tryPromise({
220 try: (): Promise<unknown> => request.clone().json(),
221 catch: () => null,
222 }).pipe(
223 // A body we cannot read is simply not ours to answer; hand it on.
224 Effect.orElseSucceed(() => null),
225 Effect.map(renderPreInitializeMethodNotFound),
226 );
227
228/** The pure decision behind {@link preInitializeMethodNotFound}. */
229const renderPreInitializeMethodNotFound = (body: unknown): Response | null => {

Callers 3

createFunction · 0.90
guardFunction · 0.85
createMcpRequestHandlerFunction · 0.85

Calls 3

jsonMethod · 0.65
cloneMethod · 0.65

Tested by 1

guardFunction · 0.68