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

Function produceConnectionTools

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

Source from the content-addressed store, hash-verified

3303 }
3304 const toolProductionInFlight = new Map<string, ToolProductionInFlight>();
3305 const produceConnectionTools = (
3306 integrationRow: IntegrationRow,
3307 ref: ConnectionRef,
3308 requestedMode: "explicit" | "background" = "explicit",
3309 ): Effect.Effect<readonly Tool[], ToolProductionError> =>
3310 Effect.suspend(() => {
3311 const key = `${ref.owner}:${String(ref.integration)}:${String(ref.name)}`;
3312 const existing = toolProductionInFlight.get(key);
3313 if (existing) {
3314 if (requestedMode === "explicit") existing.mode = "explicit";
3315 return Deferred.await(existing.deferred);
3316 }
3317
3318 const entry: ToolProductionInFlight = {
3319 deferred: Deferred.makeUnsafe<readonly Tool[], ToolProductionError>(),
3320 mode: requestedMode,
3321 };
3322 toolProductionInFlight.set(key, entry);
3323 const run = produceConnectionToolsUnshared(integrationRow, ref, () => entry.mode).pipe(
3324 Effect.exit,
3325 Effect.flatMap((exit) => Deferred.done(entry.deferred, exit)),
3326 Effect.ensuring(Effect.sync(() => void toolProductionInFlight.delete(key))),
3327 );
3328 return Effect.forkDetach(run).pipe(Effect.andThen(Deferred.await(entry.deferred)));
3329 });
3330
3331 // ------------------------------------------------------------------
3332 // 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