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

Function connectionValidate

packages/core/sdk/src/executor.ts:2887–2924  ·  view source on GitHub ↗
(
      input: ValidateConnectionInput,
    )

Source from the content-addressed store, hash-verified

2885 });
2886
2887 const connectionValidate = (
2888 input: ValidateConnectionInput,
2889 ): Effect.Effect<HealthCheckResult, IntegrationNotFoundError | StorageFailure> =>
2890 Effect.gen(function* () {
2891 const integrationRow = yield* findIntegrationRow(input.integration);
2892 if (!integrationRow) {
2893 return yield* new IntegrationNotFoundError({ slug: input.integration });
2894 }
2895 const runtime = runtimes.get(integrationRow.plugin_id);
2896 const check = runtime?.plugin.checkHealth;
2897 if (!runtime || !check) return unknownHealth();
2898
2899 const values = yield* resolveInFlightValues(input);
2900 const record = rowToIntegrationRecord(
2901 integrationRow,
2902 describeAuthMethodsForRow(integrationRow),
2903 );
2904 const credential: ToolInvocationCredential = {
2905 owner: input.owner,
2906 integration: input.integration,
2907 // No connection exists yet (key-first); a synthetic name keeps the
2908 // credential shape whole. The probe authenticates on values+template,
2909 // not on this name (it only appears in upstream-error messages).
2910 connection: ConnectionName.make("(unsaved)"),
2911 template: input.template,
2912 value: values[PRIMARY_INPUT_VARIABLE] ?? null,
2913 values,
2914 config: record.config,
2915 };
2916 // Caller override (editor preview) wins; otherwise the declared spec
2917 // from the integration row. Nothing persists here: validate is the
2918 // key-first flow's dry run.
2919 const spec = input.spec ?? describeHealthCheckForRow(integrationRow) ?? undefined;
2920 return yield* foldPluginFailure(
2921 check({ ctx: runtime.ctx, integration: record, credential, spec }),
2922 `Validating credential for "${input.integration}" failed.`,
2923 );
2924 });
2925
2926 // Clear the sync stamp so the next tools read re-produces this connection's
2927 // catalog. The deferred variant of `connectionsRefresh` for signals that

Callers

nothing calls this directly

Calls 9

findIntegrationRowFunction · 0.85
unknownHealthFunction · 0.85
resolveInFlightValuesFunction · 0.85
rowToIntegrationRecordFunction · 0.85
foldPluginFailureFunction · 0.85
getMethod · 0.65
checkFunction · 0.50

Tested by

no test coverage detected