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

Function resolvePolicyForSlug

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

Source from the content-addressed store, hash-verified

542 });
543
544 const resolvePolicyForSlug = (
545 slug: string,
546 toolId: string,
547 defaultRequiresApproval?: boolean,
548 ): Effect.Effect<EffectivePolicy, StorageFailure> =>
549 Effect.gen(function* () {
550 const toolkit = yield* getBySlugEntry(slug);
551 if (!toolkit) return blockedPolicy();
552 if (toolkit.owner === "org" && isPersonalDynamicToolId(toolId)) return blockedPolicy();
553 const policies = yield* listPoliciesForRecord(toolkit.data.id);
554 const connections = yield* listConnectionsForRecord(toolkit.data.id);
555 return resolveToolkitPolicy(
556 toolId,
557 digestToolkitRules(connections, policies),
558 defaultRequiresApproval,
559 );
560 });
561
562 // Batched form of `resolvePolicyForSlug`: fetch the toolkit, its policies, and
563 // its connections ONCE, then hand back a pure resolver core can run for every

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected