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

Function runTraced

apps/cloud/src/mcp/agent-handler.ts:176–190  ·  view source on GitHub ↗
(
  request: Request,
  env: Env,
  program: Effect.Effect<A, never, McpAuthProvider>,
)

Source from the content-addressed store, hash-verified

174// `McpAuthProvider` from it; the telemetry layer is still provided per run, so
175// spans keep exporting exactly as before.
176const runTraced = <A>(
177 request: Request,
178 env: Env,
179 program: Effect.Effect<A, never, McpAuthProvider>,
180): Promise<A> => {
181 const parsed = parseTraceparent(
182 request.headers.get("traceparent"),
183 request.headers.get("tracestate"),
184 );
185 return mcpAuthRuntimeFor(mcpAuthBindingsFingerprint(env)).runPromise(
186 (parsed ? OtelTracer.withSpanContext(program, parsed) : program).pipe(
187 Effect.provide(WorkerTelemetryLive),
188 ),
189 );
190};
191
192// The MCP resource the request targets. `server.ts` routes both the bare `/mcp`
193// and `/mcp/toolkits/<slug>` to this handler (`prepareMcpOrgScope` strips the org

Callers 1

makeCloudMcpAgentHandlerFunction · 0.85

Calls 3

parseTraceparentFunction · 0.90
getMethod · 0.65

Tested by

no test coverage detected