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

Function toolsList

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

Source from the content-addressed store, hash-verified

2956 });
2957
2958 const toolsList = (filter?: ToolListFilter): Effect.Effect<readonly Tool[], StorageFailure> =>
2959 Effect.gen(function* () {
2960 yield* syncStaleConnectionTools;
2961 // Projected: the list surface is metadata (address, description,
2962 // annotations) — loading every tool's input/output schema JSON made
2963 // an unbounded list scale with schema bytes, not tool count.
2964 const rows = yield* core.findMany("tool", {
2965 where: (b: AnyCb) =>
2966 b.and(
2967 filter?.integration === undefined
2968 ? true
2969 : b("integration", "=", String(filter.integration)),
2970 filter?.owner === undefined ? true : b("owner", "=", filter.owner),
2971 filter?.connection === undefined
2972 ? true
2973 : b("connection", "=", String(filter.connection)),
2974 ),
2975 select: TOOL_INVOCATION_COLUMNS,
2976 });
2977 const includeBlocked = filter?.includeBlocked ?? false;
2978 const policyRules = yield* listActivePolicyRuleSet();
2979 const tools: Tool[] = [];
2980 for (const row of rows) {
2981 const tool = rowToTool(row);
2982 if (!matchesToolFilter(tool, filter)) continue;
2983 if (!includeBlocked) {
2984 const effective = yield* resolvePolicyFromRuleSet(
2985 normalizedPolicyId(tool),
2986 policyRules,
2987 tool.annotations?.requiresApproval,
2988 );
2989 if (effective.action === "block") continue;
2990 }
2991 tools.push(tool);
2992 }
2993 for (const entry of staticTools.values()) {
2994 const tool = staticToolToTool(entry);
2995 if (!matchesToolFilter(tool, filter)) continue;
2996 if (!includeBlocked) {
2997 const effective = yield* resolvePolicyFromRuleSet(
2998 normalizedPolicyId(tool),
2999 policyRules,
3000 tool.annotations?.requiresApproval,
3001 );
3002 if (effective.action === "block") continue;
3003 }
3004 tools.push(tool);
3005 }
3006 return tools;
3007 });
3008
3009 const toolSchema = (
3010 address: ToolAddress,

Callers 2

integrationsListFunction · 0.85
connectionsListFunction · 0.85

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