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

Function toolsList

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

Source from the content-addressed store, hash-verified

3652 });
3653
3654 const toolsList = (filter?: ToolListFilter): Effect.Effect<readonly Tool[], StorageFailure> =>
3655 Effect.gen(function* () {
3656 yield* syncStaleConnectionTools;
3657 // Projected: the list surface is metadata (address, description,
3658 // annotations) — loading every tool's input/output schema JSON made
3659 // an unbounded list scale with schema bytes, not tool count.
3660 const rows = yield* core.findMany("tool", {
3661 where: (b: AnyCb) =>
3662 b.and(
3663 filter?.integration === undefined
3664 ? true
3665 : b("integration", "=", String(filter.integration)),
3666 filter?.owner === undefined ? true : b("owner", "=", filter.owner),
3667 filter?.connection === undefined
3668 ? true
3669 : b("connection", "=", String(filter.connection)),
3670 ),
3671 select: TOOL_INVOCATION_COLUMNS,
3672 });
3673 const includeBlocked = filter?.includeBlocked ?? false;
3674 const policyRules = yield* listActivePolicyRuleSet();
3675 const tools: Tool[] = [];
3676 for (const row of rows) {
3677 const tool = rowToTool(row);
3678 if (!matchesToolFilter(tool, filter)) continue;
3679 if (!includeBlocked) {
3680 const effective = yield* resolvePolicyFromRuleSet(
3681 normalizedPolicyId(tool),
3682 policyRules,
3683 tool.annotations?.requiresApproval,
3684 );
3685 if (effective.action === "block") continue;
3686 }
3687 tools.push(tool);
3688 }
3689 for (const entry of staticTools.values()) {
3690 const tool = staticToolToTool(entry);
3691 if (!matchesToolFilter(tool, filter)) continue;
3692 if (!includeBlocked) {
3693 const effective = yield* resolvePolicyFromRuleSet(
3694 normalizedPolicyId(tool),
3695 policyRules,
3696 tool.annotations?.requiresApproval,
3697 );
3698 if (effective.action === "block") continue;
3699 }
3700 tools.push(tool);
3701 }
3702 return tools;
3703 });
3704
3705 const toolSchema = (
3706 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