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

Function applyCallHelpChildFilters

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

1787 });
1788
1789const applyCallHelpChildFilters = (input: {
1790 readonly children: ReadonlyArray<{
1791 readonly segment: string;
1792 readonly invokable: boolean;
1793 readonly hasChildren: boolean;
1794 readonly toolCount: number;
1795 }>;
1796 readonly args: ParsedCallHelpArgs;
1797 readonly fallbackQuery: string | undefined;
1798}) => {
1799 const query = [input.fallbackQuery, input.args.match]
1800 .filter((value): value is string => typeof value === "string" && value.trim().length > 0)
1801 .join(" ")
1802 .trim();
1803 const filtered = filterToolPathChildren(input.children, query.length > 0 ? query : undefined);
1804 const children =
1805 input.args.limit && input.args.limit > 0 ? filtered.slice(0, input.args.limit) : filtered;
1806
1807 return {
1808 query: query.length > 0 ? query : undefined,
1809 filteredCount: filtered.length,
1810 totalCount: input.children.length,
1811 children,
1812 };
1813};
1814
1815const runCallHelp = (
1816 args: ParsedCallHelpArgs,

Callers 1

runCallHelpFunction · 0.85

Calls 1

filterToolPathChildrenFunction · 0.90

Tested by

no test coverage detected