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

Function toolsList

packages/core/sdk/src/executor.ts:3680–3729  ·  view source on GitHub ↗
(filter?: ToolListFilter)

Source from the content-addressed store, hash-verified

3678 });
3679
3680 const toolsList = (filter?: ToolListFilter): Effect.Effect<readonly Tool[], StorageFailure> =>
3681 Effect.gen(function* () {
3682 yield* syncStaleConnectionTools;
3683 // Projected: the list surface is metadata (address, description,
3684 // annotations) — loading every tool's input/output schema JSON made
3685 // an unbounded list scale with schema bytes, not tool count.
3686 const rows = yield* core.findMany("tool", {
3687 where: (b: AnyCb) =>
3688 b.and(
3689 filter?.integration === undefined
3690 ? true
3691 : b("integration", "=", String(filter.integration)),
3692 filter?.owner === undefined ? true : b("owner", "=", filter.owner),
3693 filter?.connection === undefined
3694 ? true
3695 : b("connection", "=", String(filter.connection)),
3696 ),
3697 select: TOOL_INVOCATION_COLUMNS,
3698 });
3699 const includeBlocked = filter?.includeBlocked ?? false;
3700 const policyRules = yield* listActivePolicyRuleSet();
3701 const tools: Tool[] = [];
3702 for (const row of rows) {
3703 const tool = rowToTool(row);
3704 if (!matchesToolFilter(tool, filter)) continue;
3705 if (!includeBlocked) {
3706 const effective = yield* resolvePolicyFromRuleSet(
3707 normalizedPolicyId(tool),
3708 policyRules,
3709 tool.annotations?.requiresApproval,
3710 );
3711 if (effective.action === "block") continue;
3712 }
3713 tools.push(tool);
3714 }
3715 for (const entry of staticTools.values()) {
3716 const tool = staticToolToTool(entry);
3717 if (!matchesToolFilter(tool, filter)) continue;
3718 if (!includeBlocked) {
3719 const effective = yield* resolvePolicyFromRuleSet(
3720 normalizedPolicyId(tool),
3721 policyRules,
3722 tool.annotations?.requiresApproval,
3723 );
3724 if (effective.action === "block") continue;
3725 }
3726 tools.push(tool);
3727 }
3728 return tools;
3729 });
3730
3731 const toolSchema = (
3732 address: ToolAddress,

Callers 2

integrationsListFunction · 0.70
connectionsListFunction · 0.70

Calls 8

listActivePolicyRuleSetFunction · 0.85
rowToToolFunction · 0.85
matchesToolFilterFunction · 0.85
resolvePolicyFromRuleSetFunction · 0.85
normalizedPolicyIdFunction · 0.85
staticToolToToolFunction · 0.85
pushMethod · 0.80
valuesMethod · 0.80

Tested by

no test coverage detected