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

Function produceConnectionTools

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

Source from the content-addressed store, hash-verified

3710 }
3711 const toolProductionInFlight = new Map<string, ToolProductionInFlight>();
3712 const produceConnectionTools = (
3713 integrationRow: IntegrationRow,
3714 ref: ConnectionRef,
3715 requestedMode: "explicit" | "background" = "explicit",
3716 ): Effect.Effect<readonly Tool[], ToolProductionError> =>
3717 Effect.suspend(() => {
3718 const key = `${ref.owner}:${String(ref.integration)}:${String(ref.name)}`;
3719 const existing = toolProductionInFlight.get(key);
3720 if (existing) {
3721 if (requestedMode === "explicit") existing.mode = "explicit";
3722 return Deferred.await(existing.deferred);
3723 }
3724
3725 const entry: ToolProductionInFlight = {
3726 deferred: Deferred.makeUnsafe<readonly Tool[], ToolProductionError>(),
3727 mode: requestedMode,
3728 };
3729 toolProductionInFlight.set(key, entry);
3730 const run = produceConnectionToolsUnshared(integrationRow, ref, () => entry.mode).pipe(
3731 Effect.exit,
3732 Effect.flatMap((exit) => Deferred.done(entry.deferred, exit)),
3733 Effect.ensuring(Effect.sync(() => void toolProductionInFlight.delete(key))),
3734 );
3735 return Effect.forkDetach(run).pipe(Effect.andThen(Deferred.await(entry.deferred)));
3736 });
3737
3738 // ------------------------------------------------------------------
3739 // 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