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

Function dynamicScopeCondition

packages/core/sdk/src/executor.ts:5717–5734  ·  view source on GitHub ↗
(
      ruleSet: ActivePolicyRuleSet,
    )

Source from the content-addressed store, hash-verified

5715 // read. Any unbounded prefix (a bare `*`, or wildcards in every position)
5716 // makes the whole scope unrestricted.
5717 const dynamicScopeCondition = (
5718 ruleSet: ActivePolicyRuleSet,
5719 ): ((b: AnyCb) => Condition | boolean) | null | false => {
5720 if (ruleSet.kind !== "prepared" || ruleSet.dynamicScope === undefined) return null;
5721 const scopes = ruleSet.dynamicScope;
5722 if (scopes.length === 0) return false;
5723 if (scopes.some(isUnboundedDynamicToolScope)) return null;
5724 return (b: AnyCb) =>
5725 b.or(
5726 ...scopes.map((scope) =>
5727 b.and(
5728 scope.integration === null ? true : b("integration", "=", scope.integration),
5729 scope.owner === null ? true : b("owner", "=", scope.owner),
5730 scope.connection === null ? true : b("connection", "=", scope.connection),
5731 ),
5732 ),
5733 );
5734 };
5735
5736 // `awaitStaleSync: false` still starts the bounded background sync (so
5737 // catalogs converge for sessions that only ever list connections) but

Callers 1

readToolsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected