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

Function produceConnectionTools

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

Source from the content-addressed store, hash-verified

3086 }
3087 const toolProductionInFlight = new Map<string, ToolProductionInFlight>();
3088 const produceConnectionTools = (
3089 integrationRow: IntegrationRow,
3090 ref: ConnectionRef,
3091 requestedMode: "explicit" | "background" = "explicit",
3092 ): Effect.Effect<readonly Tool[], ToolProductionError> =>
3093 Effect.suspend(() => {
3094 const key = `${ref.owner}:${String(ref.integration)}:${String(ref.name)}`;
3095 const existing = toolProductionInFlight.get(key);
3096 if (existing) {
3097 if (requestedMode === "explicit") existing.mode = "explicit";
3098 return Deferred.await(existing.deferred);
3099 }
3100
3101 const entry: ToolProductionInFlight = {
3102 deferred: Deferred.makeUnsafe<readonly Tool[], ToolProductionError>(),
3103 mode: requestedMode,
3104 };
3105 toolProductionInFlight.set(key, entry);
3106 const run = produceConnectionToolsUnshared(integrationRow, ref, () => entry.mode).pipe(
3107 Effect.exit,
3108 Effect.flatMap((exit) => Deferred.done(entry.deferred, exit)),
3109 Effect.ensuring(Effect.sync(() => void toolProductionInFlight.delete(key))),
3110 );
3111 return Effect.forkDetach(run).pipe(Effect.andThen(Deferred.await(entry.deferred)));
3112 });
3113
3114 // ------------------------------------------------------------------
3115 // 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