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

Function filterToolPathChildren

apps/cli/src/tooling.ts:376–394  ·  view source on GitHub ↗
(
  children: ReadonlyArray<ToolPathChildEntry>,
  query: string | undefined,
)

Source from the content-addressed store, hash-verified

374};
375
376export const filterToolPathChildren = (
377 children: ReadonlyArray<ToolPathChildEntry>,
378 query: string | undefined,
379): ReadonlyArray<ToolPathChildEntry> => {
380 if (!query || query.trim().length === 0) {
381 return children;
382 }
383 const tokens = query
384 .trim()
385 .toLowerCase()
386 .split(/\s+/)
387 .filter((token) => token.length > 0);
388 if (tokens.length === 0) {
389 return children;
390 }
391 return children.filter((child) =>
392 tokens.every((token) => segmentMatchesToken(child.segment, token)),
393 );
394};
395
396export const buildSearchToolsCode = (input: {
397 query: string;

Callers 2

tools-cli.test.tsFile · 0.90

Calls 1

segmentMatchesTokenFunction · 0.85

Tested by

no test coverage detected