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

Function resolvePolicyForSlug

packages/plugins/toolkits/src/server.ts:498–510  ·  view source on GitHub ↗
(
    slug: string,
    toolId: string,
    defaultRequiresApproval?: boolean,
  )

Source from the content-addressed store, hash-verified

496 });
497
498 const resolvePolicyForSlug = (
499 slug: string,
500 toolId: string,
501 defaultRequiresApproval?: boolean,
502 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
503 Effect.gen(function* () {
504 const toolkit = yield* getBySlugEntry(slug);
505 if (!toolkit) return blockedPolicy();
506 if (toolkit.owner === "org" && isPersonalDynamicToolId(toolId)) return blockedPolicy();
507 const policies = yield* listPoliciesForRecord(toolkit.data.id);
508 const connections = yield* listConnectionsForRecord(toolkit.data.id);
509 return resolveToolkitPolicy(toolId, connections, policies, defaultRequiresApproval);
510 });
511
512 // Batched form of `resolvePolicyForSlug`: fetch the toolkit, its policies, and
513 // its connections ONCE, then hand back a pure resolver core can run for every

Callers

nothing calls this directly

Calls 6

getBySlugEntryFunction · 0.85
blockedPolicyFunction · 0.85
isPersonalDynamicToolIdFunction · 0.85
listPoliciesForRecordFunction · 0.85
listConnectionsForRecordFunction · 0.85
resolveToolkitPolicyFunction · 0.70

Tested by

no test coverage detected