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

Function applyCallHelpChildFilters

apps/cli/src/main.ts:1820–1844  ·  view source on GitHub ↗
(input: {
  readonly children: ReadonlyArray<{
    readonly segment: string;
    readonly invokable: boolean;
    readonly hasChildren: boolean;
    readonly toolCount: number;
  }>;
  readonly args: ParsedCallHelpArgs;
  readonly fallbackQuery: string | undefined;
})

Source from the content-addressed store, hash-verified

1818 });
1819
1820const applyCallHelpChildFilters = (input: {
1821 readonly children: ReadonlyArray<{
1822 readonly segment: string;
1823 readonly invokable: boolean;
1824 readonly hasChildren: boolean;
1825 readonly toolCount: number;
1826 }>;
1827 readonly args: ParsedCallHelpArgs;
1828 readonly fallbackQuery: string | undefined;
1829}) => {
1830 const query = [input.fallbackQuery, input.args.match]
1831 .filter((value): value is string => typeof value === "string" && value.trim().length > 0)
1832 .join(" ")
1833 .trim();
1834 const filtered = filterToolPathChildren(input.children, query.length > 0 ? query : undefined);
1835 const children =
1836 input.args.limit && input.args.limit > 0 ? filtered.slice(0, input.args.limit) : filtered;
1837
1838 return {
1839 query: query.length > 0 ? query : undefined,
1840 filteredCount: filtered.length,
1841 totalCount: input.children.length,
1842 children,
1843 };
1844};
1845
1846const runCallHelp = (
1847 args: ParsedCallHelpArgs,

Callers 1

runCallHelpFunction · 0.85

Calls 1

filterToolPathChildrenFunction · 0.90

Tested by

no test coverage detected