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

Function runTraced

apps/cloud/src/mcp/agent-handler.ts:99–109  ·  view source on GitHub ↗
(request: Request, program: Effect.Effect<A>)

Source from the content-addressed store, hash-verified

97// (via Effect.currentParentSpan) ferry that same trace into the session DO
98// instead of letting the DO start a fresh root per request.
99const runTraced = <A>(request: Request, program: Effect.Effect<A>): Promise<A> => {
100 const parsed = parseTraceparent(
101 request.headers.get("traceparent"),
102 request.headers.get("tracestate"),
103 );
104 return Effect.runPromise(
105 (parsed ? OtelTracer.withSpanContext(program, parsed) : program).pipe(
106 Effect.provide(WorkerTelemetryLive),
107 ),
108 );
109};
110
111// The MCP resource the request targets. `server.ts` routes both the bare `/mcp`
112// and `/mcp/toolkits/<slug>` to this handler (`prepareMcpOrgScope` strips the org

Callers 1

makeCloudMcpAgentHandlerFunction · 0.85

Calls 2

parseTraceparentFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected