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

Function produceConnectionTools

packages/core/sdk/src/executor.ts:3512–3536  ·  view source on GitHub ↗
(
      integrationRow: IntegrationRow,
      ref: ConnectionRef,
      requestedMode: "explicit" | "background" = "explicit",
    )

Source from the content-addressed store, hash-verified

3510 }
3511 const toolProductionInFlight = new Map<string, ToolProductionInFlight>();
3512 const produceConnectionTools = (
3513 integrationRow: IntegrationRow,
3514 ref: ConnectionRef,
3515 requestedMode: "explicit" | "background" = "explicit",
3516 ): Effect.Effect<readonly Tool[], ToolProductionError> =>
3517 Effect.suspend(() => {
3518 const key = `${ref.owner}:${String(ref.integration)}:${String(ref.name)}`;
3519 const existing = toolProductionInFlight.get(key);
3520 if (existing) {
3521 if (requestedMode === "explicit") existing.mode = "explicit";
3522 return Deferred.await(existing.deferred);
3523 }
3524
3525 const entry: ToolProductionInFlight = {
3526 deferred: Deferred.makeUnsafe<readonly Tool[], ToolProductionError>(),
3527 mode: requestedMode,
3528 };
3529 toolProductionInFlight.set(key, entry);
3530 const run = produceConnectionToolsUnshared(integrationRow, ref, () => entry.mode).pipe(
3531 Effect.exit,
3532 Effect.flatMap((exit) => Deferred.done(entry.deferred, exit)),
3533 Effect.ensuring(Effect.sync(() => void toolProductionInFlight.delete(key))),
3534 );
3535 return Effect.forkDetach(run).pipe(Effect.andThen(Deferred.await(entry.deferred)));
3536 });
3537
3538 // ------------------------------------------------------------------
3539 // Connections

Callers 4

connectionsCreateFunction · 0.85
mintOAuthConnectionFunction · 0.85
connectionsRefreshFunction · 0.85
createExecutorFunction · 0.85

Calls 5

getMethod · 0.65
setMethod · 0.65
syncMethod · 0.65
deleteMethod · 0.65

Tested by

no test coverage detected