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

Function applyCallHelpChildFilters

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

1861 });
1862
1863const applyCallHelpChildFilters = (input: {
1864 readonly children: ReadonlyArray<{
1865 readonly segment: string;
1866 readonly invokable: boolean;
1867 readonly hasChildren: boolean;
1868 readonly toolCount: number;
1869 }>;
1870 readonly args: ParsedCallHelpArgs;
1871 readonly fallbackQuery: string | undefined;
1872}) => {
1873 const query = [input.fallbackQuery, input.args.match]
1874 .filter((value): value is string => typeof value === "string" && value.trim().length > 0)
1875 .join(" ")
1876 .trim();
1877 const filtered = filterToolPathChildren(input.children, query.length > 0 ? query : undefined);
1878 const children =
1879 input.args.limit && input.args.limit > 0 ? filtered.slice(0, input.args.limit) : filtered;
1880
1881 return {
1882 query: query.length > 0 ? query : undefined,
1883 filteredCount: filtered.length,
1884 totalCount: input.children.length,
1885 children,
1886 };
1887};
1888
1889const runCallHelp = (
1890 args: ParsedCallHelpArgs,

Callers 1

runCallHelpFunction · 0.85

Calls 1

filterToolPathChildrenFunction · 0.90

Tested by

no test coverage detected