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

Function toolsList

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

Source from the content-addressed store, hash-verified

3565 });
3566
3567 const toolsList = (filter?: ToolListFilter): Effect.Effect<readonly Tool[], StorageFailure> =>
3568 Effect.gen(function* () {
3569 yield* syncStaleConnectionTools;
3570 // Projected: the list surface is metadata (address, description,
3571 // annotations) — loading every tool's input/output schema JSON made
3572 // an unbounded list scale with schema bytes, not tool count.
3573 const rows = yield* core.findMany("tool", {
3574 where: (b: AnyCb) =>
3575 b.and(
3576 filter?.integration === undefined
3577 ? true
3578 : b("integration", "=", String(filter.integration)),
3579 filter?.owner === undefined ? true : b("owner", "=", filter.owner),
3580 filter?.connection === undefined
3581 ? true
3582 : b("connection", "=", String(filter.connection)),
3583 ),
3584 select: TOOL_INVOCATION_COLUMNS,
3585 });
3586 const includeBlocked = filter?.includeBlocked ?? false;
3587 const policyRules = yield* listActivePolicyRuleSet();
3588 const tools: Tool[] = [];
3589 for (const row of rows) {
3590 const tool = rowToTool(row);
3591 if (!matchesToolFilter(tool, filter)) continue;
3592 if (!includeBlocked) {
3593 const effective = yield* resolvePolicyFromRuleSet(
3594 normalizedPolicyId(tool),
3595 policyRules,
3596 tool.annotations?.requiresApproval,
3597 );
3598 if (effective.action === "block") continue;
3599 }
3600 tools.push(tool);
3601 }
3602 for (const entry of staticTools.values()) {
3603 const tool = staticToolToTool(entry);
3604 if (!matchesToolFilter(tool, filter)) continue;
3605 if (!includeBlocked) {
3606 const effective = yield* resolvePolicyFromRuleSet(
3607 normalizedPolicyId(tool),
3608 policyRules,
3609 tool.annotations?.requiresApproval,
3610 );
3611 if (effective.action === "block") continue;
3612 }
3613 tools.push(tool);
3614 }
3615 return tools;
3616 });
3617
3618 const toolSchema = (
3619 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