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

Function toolsList

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

Source from the content-addressed store, hash-verified

3724 });
3725
3726 const toolsList = (filter?: ToolListFilter): Effect.Effect<readonly Tool[], StorageFailure> =>
3727 Effect.gen(function* () {
3728 yield* syncStaleConnectionTools;
3729 // Projected: the list surface is metadata (address, description,
3730 // annotations) — loading every tool's input/output schema JSON made
3731 // an unbounded list scale with schema bytes, not tool count.
3732 const rows = yield* core.findMany("tool", {
3733 where: (b: AnyCb) =>
3734 b.and(
3735 filter?.integration === undefined
3736 ? true
3737 : b("integration", "=", String(filter.integration)),
3738 filter?.owner === undefined ? true : b("owner", "=", filter.owner),
3739 filter?.connection === undefined
3740 ? true
3741 : b("connection", "=", String(filter.connection)),
3742 ),
3743 select: TOOL_INVOCATION_COLUMNS,
3744 });
3745 const includeBlocked = filter?.includeBlocked ?? false;
3746 const policyRules = yield* listActivePolicyRuleSet();
3747 const tools: Tool[] = [];
3748 for (const row of rows) {
3749 const tool = rowToTool(row);
3750 if (!matchesToolFilter(tool, filter)) continue;
3751 if (!includeBlocked) {
3752 const effective = yield* resolvePolicyFromRuleSet(
3753 normalizedPolicyId(tool),
3754 policyRules,
3755 tool.annotations?.requiresApproval,
3756 );
3757 if (effective.action === "block") continue;
3758 }
3759 tools.push(tool);
3760 }
3761 for (const entry of staticTools.values()) {
3762 const tool = staticToolToTool(entry);
3763 if (!matchesToolFilter(tool, filter)) continue;
3764 if (!includeBlocked) {
3765 const effective = yield* resolvePolicyFromRuleSet(
3766 normalizedPolicyId(tool),
3767 policyRules,
3768 tool.annotations?.requiresApproval,
3769 );
3770 if (effective.action === "block") continue;
3771 }
3772 tools.push(tool);
3773 }
3774 return tools;
3775 });
3776
3777 const toolSchema = (
3778 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