MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / compose

Method compose

src/mcp/tools.ts:8370–8393  ·  view source on GitHub ↗
(bodies: Body[], rest: Node[])

Source from the content-addressed store, hash-verified

8368
8369 const LIST_CAP = 20;
8370 const compose = (bodies: Body[], rest: Node[]): string => {
8371 const restInCapOrder = capOrderOf(rest);
8372 const listed = inIndexOrder(restInCapOrder.slice(0, LIST_CAP), (n) => n);
8373 const omitted = restInCapOrder.slice(LIST_CAP);
8374 const out: string[] = [
8375 header,
8376 `Returning ${bodies.length} in full${rest.length ? `; ${rest.length} more listed below` : ''} — pick the one you need (no Read required).`,
8377 '',
8378 inIndexOrder(bodies, (b) => b.node).map((b) => b.section).join('\n\n---\n\n'),
8379 ];
8380 if (listed.length) {
8381 out.push(
8382 '',
8383 '**Other definitions**',
8384 ...listed.map(listLine),
8385 );
8386 if (omitted.length) out.push(omittedLine(omitted));
8387 out.push(
8388 '',
8389 `> Need one of these in full? Call codegraph_node again with \`file\` (e.g. \`"${listed[0]!.filePath.split('/').pop()}"\`) or \`line\` — do NOT Read it.`,
8390 );
8391 }
8392 return out.join('\n');
8393 };
8394
8395 // Each language still without a body gets its first hand-written
8396 // definition rendered on top, while the whole answer stays under the

Callers

nothing calls this directly

Calls 3

mapMethod · 0.80
pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected