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

Function applyCallHelpChildFilters

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

1764 });
1765
1766const applyCallHelpChildFilters = (input: {
1767 readonly children: ReadonlyArray<{
1768 readonly segment: string;
1769 readonly invokable: boolean;
1770 readonly hasChildren: boolean;
1771 readonly toolCount: number;
1772 }>;
1773 readonly args: ParsedCallHelpArgs;
1774 readonly fallbackQuery: string | undefined;
1775}) => {
1776 const query = [input.fallbackQuery, input.args.match]
1777 .filter((value): value is string => typeof value === "string" && value.trim().length > 0)
1778 .join(" ")
1779 .trim();
1780 const filtered = filterToolPathChildren(input.children, query.length > 0 ? query : undefined);
1781 const children =
1782 input.args.limit && input.args.limit > 0 ? filtered.slice(0, input.args.limit) : filtered;
1783
1784 return {
1785 query: query.length > 0 ? query : undefined,
1786 filteredCount: filtered.length,
1787 totalCount: input.children.length,
1788 children,
1789 };
1790};
1791
1792const runCallHelp = (
1793 args: ParsedCallHelpArgs,

Callers 1

runCallHelpFunction · 0.85

Calls 1

filterToolPathChildrenFunction · 0.90

Tested by

no test coverage detected