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

Function produceConnectionTools

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

Source from the content-addressed store, hash-verified

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

Callers 4

connectionsCreateFunction · 0.85
mintOAuthConnectionFunction · 0.85
connectionsRefreshFunction · 0.85
syncStaleConnectionToolsFunction · 0.85

Calls 5

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

Tested by

no test coverage detected