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

Function runTraced

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

Source from the content-addressed store, hash-verified

141// (via Effect.currentParentSpan) ferry that same trace into the session DO
142// instead of letting the DO start a fresh root per request.
143const runTraced = <A>(request: Request, program: Effect.Effect<A>): Promise<A> => {
144 const parsed = parseTraceparent(
145 request.headers.get("traceparent"),
146 request.headers.get("tracestate"),
147 );
148 return Effect.runPromise(
149 (parsed ? OtelTracer.withSpanContext(program, parsed) : program).pipe(
150 Effect.provide(WorkerTelemetryLive),
151 ),
152 );
153};
154
155// The MCP resource the request targets. `server.ts` routes both the bare `/mcp`
156// 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