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

Function runTraced

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

Source from the content-addressed store, hash-verified

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