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

Function produceConnectionTools

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

Source from the content-addressed store, hash-verified

3773 }
3774 const toolProductionInFlight = new Map<string, ToolProductionInFlight>();
3775 const produceConnectionTools = (
3776 integrationRow: IntegrationRow,
3777 ref: ConnectionRef,
3778 requestedMode: "explicit" | "background" = "explicit",
3779 ): Effect.Effect<readonly Tool[], ToolProductionError> =>
3780 Effect.suspend(() => {
3781 const key = `${ref.owner}:${String(ref.integration)}:${String(ref.name)}`;
3782 const existing = toolProductionInFlight.get(key);
3783 if (existing) {
3784 if (requestedMode === "explicit") existing.mode = "explicit";
3785 return Deferred.await(existing.deferred);
3786 }
3787
3788 const entry: ToolProductionInFlight = {
3789 deferred: Deferred.makeUnsafe<readonly Tool[], ToolProductionError>(),
3790 mode: requestedMode,
3791 };
3792 toolProductionInFlight.set(key, entry);
3793 const run = produceConnectionToolsUnshared(integrationRow, ref, () => entry.mode).pipe(
3794 Effect.exit,
3795 Effect.flatMap((exit) => Deferred.done(entry.deferred, exit)),
3796 Effect.ensuring(Effect.sync(() => void toolProductionInFlight.delete(key))),
3797 );
3798 return Effect.forkDetach(run).pipe(Effect.andThen(Deferred.await(entry.deferred)));
3799 });
3800
3801 // ------------------------------------------------------------------
3802 // 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