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

Function applyCallHelpChildFilters

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

1840 });
1841
1842const applyCallHelpChildFilters = (input: {
1843 readonly children: ReadonlyArray<{
1844 readonly segment: string;
1845 readonly invokable: boolean;
1846 readonly hasChildren: boolean;
1847 readonly toolCount: number;
1848 }>;
1849 readonly args: ParsedCallHelpArgs;
1850 readonly fallbackQuery: string | undefined;
1851}) => {
1852 const query = [input.fallbackQuery, input.args.match]
1853 .filter((value): value is string => typeof value === "string" && value.trim().length > 0)
1854 .join(" ")
1855 .trim();
1856 const filtered = filterToolPathChildren(input.children, query.length > 0 ? query : undefined);
1857 const children =
1858 input.args.limit && input.args.limit > 0 ? filtered.slice(0, input.args.limit) : filtered;
1859
1860 return {
1861 query: query.length > 0 ? query : undefined,
1862 filteredCount: filtered.length,
1863 totalCount: input.children.length,
1864 children,
1865 };
1866};
1867
1868const runCallHelp = (
1869 args: ParsedCallHelpArgs,

Callers 1

runCallHelpFunction · 0.85

Calls 1

filterToolPathChildrenFunction · 0.90

Tested by

no test coverage detected