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

Function applyCallHelpChildFilters

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

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

Callers 1

runCallHelpFunction · 0.85

Calls 1

filterToolPathChildrenFunction · 0.90

Tested by

no test coverage detected