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

Function policiesResolve

packages/core/sdk/src/executor.ts:3493–3520  ·  view source on GitHub ↗
(
      address: ToolAddress,
    )

Source from the content-addressed store, hash-verified

3491 });
3492
3493 const policiesResolve = (
3494 address: ToolAddress,
3495 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
3496 Effect.gen(function* () {
3497 const parsed = parseToolAddress(String(address));
3498 const policyRows = yield* core.findMany("tool_policy", {});
3499 const toolId = parsed
3500 ? `${parsed.integration}.${parsed.owner}.${parsed.connection}.${parsed.tool}`
3501 : String(address);
3502 // Find the tool to read its default approval annotation.
3503 let requiresApproval: boolean | undefined;
3504 if (parsed) {
3505 const row = yield* core.findFirst("tool", {
3506 where: (b: AnyCb) =>
3507 b.and(
3508 byOwner(parsed.owner)(b),
3509 b("integration", "=", String(parsed.integration)),
3510 b("connection", "=", String(parsed.connection)),
3511 b("name", "=", String(parsed.tool)),
3512 ),
3513 });
3514 if (row) {
3515 const annotations = decodeJsonColumn(row.annotations) as ToolAnnotations | undefined;
3516 requiresApproval = annotations?.requiresApproval;
3517 }
3518 }
3519 return resolveEffectivePolicy(toolId, policyRows, ownerRankForRow, requiresApproval);
3520 });
3521
3522 // ------------------------------------------------------------------
3523 // Elicitation

Callers

nothing calls this directly

Calls 4

resolveEffectivePolicyFunction · 0.90
parseToolAddressFunction · 0.85
byOwnerFunction · 0.85
decodeJsonColumnFunction · 0.85

Tested by

no test coverage detected