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

Function applyCallHelpChildFilters

apps/cli/src/main.ts:1874–1898  ·  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

1872 });
1873
1874const applyCallHelpChildFilters = (input: {
1875 readonly children: ReadonlyArray<{
1876 readonly segment: string;
1877 readonly invokable: boolean;
1878 readonly hasChildren: boolean;
1879 readonly toolCount: number;
1880 }>;
1881 readonly args: ParsedCallHelpArgs;
1882 readonly fallbackQuery: string | undefined;
1883}) => {
1884 const query = [input.fallbackQuery, input.args.match]
1885 .filter((value): value is string => typeof value === "string" && value.trim().length > 0)
1886 .join(" ")
1887 .trim();
1888 const filtered = filterToolPathChildren(input.children, query.length > 0 ? query : undefined);
1889 const children =
1890 input.args.limit && input.args.limit > 0 ? filtered.slice(0, input.args.limit) : filtered;
1891
1892 return {
1893 query: query.length > 0 ? query : undefined,
1894 filteredCount: filtered.length,
1895 totalCount: input.children.length,
1896 children,
1897 };
1898};
1899
1900const runCallHelp = (
1901 args: ParsedCallHelpArgs,

Callers 1

runCallHelpFunction · 0.85

Calls 1

filterToolPathChildrenFunction · 0.90

Tested by

no test coverage detected