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

Function toolsList

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

Source from the content-addressed store, hash-verified

4087 });
4088
4089 const toolsList = (filter?: ToolListFilter): Effect.Effect<readonly Tool[], StorageFailure> =>
4090 Effect.gen(function* () {
4091 yield* syncStaleConnectionTools;
4092 // Projected: the list surface is metadata (address, description,
4093 // annotations) — loading every tool's input/output schema JSON made
4094 // an unbounded list scale with schema bytes, not tool count.
4095 const rows = yield* core.findMany("tool", {
4096 where: (b: AnyCb) =>
4097 b.and(
4098 filter?.integration === undefined
4099 ? true
4100 : b("integration", "=", String(filter.integration)),
4101 filter?.owner === undefined ? true : b("owner", "=", filter.owner),
4102 filter?.connection === undefined
4103 ? true
4104 : b("connection", "=", String(filter.connection)),
4105 ),
4106 select: TOOL_INVOCATION_COLUMNS,
4107 });
4108 const includeBlocked = filter?.includeBlocked ?? false;
4109 const policyRules = yield* listActivePolicyRuleSet();
4110 const tools: Tool[] = [];
4111 for (const row of rows) {
4112 const tool = rowToTool(row);
4113 if (!matchesToolFilter(tool, filter)) continue;
4114 if (!includeBlocked) {
4115 const effective = yield* resolvePolicyFromRuleSet(
4116 normalizedPolicyId(tool),
4117 policyRules,
4118 tool.annotations?.requiresApproval,
4119 );
4120 if (effective.action === "block") continue;
4121 }
4122 tools.push(tool);
4123 }
4124 for (const entry of staticTools.values()) {
4125 const tool = staticToolToTool(entry);
4126 if (!matchesToolFilter(tool, filter)) continue;
4127 if (!includeBlocked) {
4128 const effective = yield* resolvePolicyFromRuleSet(
4129 normalizedPolicyId(tool),
4130 policyRules,
4131 tool.annotations?.requiresApproval,
4132 );
4133 if (effective.action === "block") continue;
4134 }
4135 tools.push(tool);
4136 }
4137 return tools;
4138 });
4139
4140 const toolSchema = (
4141 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