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

Function toolsList

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

Source from the content-addressed store, hash-verified

4361 });
4362
4363 const toolsList = (filter?: ToolListFilter): Effect.Effect<readonly Tool[], StorageFailure> =>
4364 Effect.gen(function* () {
4365 if (toolsSyncGraceMs === null) {
4366 yield* syncStaleConnectionTools;
4367 } else {
4368 yield* awaitStaleSyncWithinGrace(toolsSyncGraceMs);
4369 }
4370 // Projected: the list surface is metadata (address, description,
4371 // annotations) — loading every tool's input/output schema JSON made
4372 // an unbounded list scale with schema bytes, not tool count.
4373 const rows = yield* core.findMany("tool", {
4374 where: (b: AnyCb) =>
4375 b.and(
4376 filter?.integration === undefined
4377 ? true
4378 : b("integration", "=", String(filter.integration)),
4379 filter?.owner === undefined ? true : b("owner", "=", filter.owner),
4380 filter?.connection === undefined
4381 ? true
4382 : b("connection", "=", String(filter.connection)),
4383 ),
4384 select: TOOL_INVOCATION_COLUMNS,
4385 });
4386 const includeBlocked = filter?.includeBlocked ?? false;
4387 const policyRules = yield* listActivePolicyRuleSet();
4388 const tools: Tool[] = [];
4389 for (const row of rows) {
4390 const tool = rowToTool(row);
4391 if (!matchesToolFilter(tool, filter)) continue;
4392 if (!includeBlocked) {
4393 const effective = yield* resolvePolicyFromRuleSet(
4394 normalizedPolicyId(tool),
4395 policyRules,
4396 tool.annotations?.requiresApproval,
4397 );
4398 if (effective.action === "block") continue;
4399 }
4400 tools.push(tool);
4401 }
4402 for (const entry of staticTools.values()) {
4403 const tool = staticToolToTool(entry);
4404 if (!matchesToolFilter(tool, filter)) continue;
4405 if (!includeBlocked) {
4406 const effective = yield* resolvePolicyFromRuleSet(
4407 normalizedPolicyId(tool),
4408 policyRules,
4409 tool.annotations?.requiresApproval,
4410 );
4411 if (effective.action === "block") continue;
4412 }
4413 tools.push(tool);
4414 }
4415 return tools;
4416 });
4417
4418 const toolSchema = (
4419 address: ToolAddress,

Callers 2

integrationsListFunction · 0.70
connectionsListFunction · 0.70

Calls 9

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