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

Function applyCallHelpChildFilters

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

1882 });
1883
1884const applyCallHelpChildFilters = (input: {
1885 readonly children: ReadonlyArray<{
1886 readonly segment: string;
1887 readonly invokable: boolean;
1888 readonly hasChildren: boolean;
1889 readonly toolCount: number;
1890 }>;
1891 readonly args: ParsedCallHelpArgs;
1892 readonly fallbackQuery: string | undefined;
1893}) => {
1894 const query = [input.fallbackQuery, input.args.match]
1895 .filter((value): value is string => typeof value === "string" && value.trim().length > 0)
1896 .join(" ")
1897 .trim();
1898 const filtered = filterToolPathChildren(input.children, query.length > 0 ? query : undefined);
1899 const children =
1900 input.args.limit && input.args.limit > 0 ? filtered.slice(0, input.args.limit) : filtered;
1901
1902 return {
1903 query: query.length > 0 ? query : undefined,
1904 filteredCount: filtered.length,
1905 totalCount: input.children.length,
1906 children,
1907 };
1908};
1909
1910const runCallHelp = (
1911 args: ParsedCallHelpArgs,

Callers 1

runCallHelpFunction · 0.85

Calls 1

filterToolPathChildrenFunction · 0.90

Tested by

no test coverage detected