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

Function resolvePolicyForSlug

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

Source from the content-addressed store, hash-verified

497 });
498
499 const resolvePolicyForSlug = (
500 slug: string,
501 toolId: string,
502 defaultRequiresApproval?: boolean,
503 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
504 Effect.gen(function* () {
505 const toolkit = yield* getBySlugEntry(slug);
506 if (!toolkit) return blockedPolicy();
507 if (toolkit.owner === "org" && isPersonalDynamicToolId(toolId)) return blockedPolicy();
508 const policies = yield* listPoliciesForRecord(toolkit.data.id);
509 const connections = yield* listConnectionsForRecord(toolkit.data.id);
510 return resolveToolkitPolicy(toolId, connections, policies, defaultRequiresApproval);
511 });
512
513 // Batched form of `resolvePolicyForSlug`: fetch the toolkit, its policies, and
514 // 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