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

Function toolsList

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

Source from the content-addressed store, hash-verified

3152 });
3153
3154 const toolsList = (filter?: ToolListFilter): Effect.Effect<readonly Tool[], StorageFailure> =>
3155 Effect.gen(function* () {
3156 yield* syncStaleConnectionTools;
3157 // Projected: the list surface is metadata (address, description,
3158 // annotations) — loading every tool's input/output schema JSON made
3159 // an unbounded list scale with schema bytes, not tool count.
3160 const rows = yield* core.findMany("tool", {
3161 where: (b: AnyCb) =>
3162 b.and(
3163 filter?.integration === undefined
3164 ? true
3165 : b("integration", "=", String(filter.integration)),
3166 filter?.owner === undefined ? true : b("owner", "=", filter.owner),
3167 filter?.connection === undefined
3168 ? true
3169 : b("connection", "=", String(filter.connection)),
3170 ),
3171 select: TOOL_INVOCATION_COLUMNS,
3172 });
3173 const includeBlocked = filter?.includeBlocked ?? false;
3174 const policyRules = yield* listActivePolicyRuleSet();
3175 const tools: Tool[] = [];
3176 for (const row of rows) {
3177 const tool = rowToTool(row);
3178 if (!matchesToolFilter(tool, filter)) continue;
3179 if (!includeBlocked) {
3180 const effective = yield* resolvePolicyFromRuleSet(
3181 normalizedPolicyId(tool),
3182 policyRules,
3183 tool.annotations?.requiresApproval,
3184 );
3185 if (effective.action === "block") continue;
3186 }
3187 tools.push(tool);
3188 }
3189 for (const entry of staticTools.values()) {
3190 const tool = staticToolToTool(entry);
3191 if (!matchesToolFilter(tool, filter)) continue;
3192 if (!includeBlocked) {
3193 const effective = yield* resolvePolicyFromRuleSet(
3194 normalizedPolicyId(tool),
3195 policyRules,
3196 tool.annotations?.requiresApproval,
3197 );
3198 if (effective.action === "block") continue;
3199 }
3200 tools.push(tool);
3201 }
3202 return tools;
3203 });
3204
3205 const toolSchema = (
3206 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