MCPcopy Index your code
hub / github.com/colbymchenry/codegraph / buildContainerOutline

Method buildContainerOutline

src/mcp/tools.ts:4504–4517  ·  view source on GitHub ↗

* Build a compact structural outline of a container symbol from its * indexed children (methods, fields, properties, …) — name, kind, * line number, and signature — so the agent gets the shape of a class * without the full source of every method. Returns '' when the container * has no in

(cg: CodeGraph, node: Node)

Source from the content-addressed store, hash-verified

4502 * has no indexed children, so the caller can fall back to full source.
4503 */
4504 private buildContainerOutline(cg: CodeGraph, node: Node): string {
4505 const children = cg.getChildren(node.id)
4506 .filter(c => c.kind !== 'import' && c.kind !== 'export')
4507 .sort((a, b) => (a.startLine ?? 0) - (b.startLine ?? 0));
4508 if (children.length === 0) return '';
4509
4510 const lines = [`**Members (${children.length}):**`, ''];
4511 for (const c of children) {
4512 const loc = c.startLine ? `:${c.startLine}` : '';
4513 const sig = c.signature ? ` — \`${c.signature}\`` : '';
4514 lines.push(`- ${c.name} (${c.kind})${loc}${sig}`);
4515 }
4516 return lines.join('\n');
4517 }
4518
4519 private formatNodeDetails(node: Node, code: string | null, outline?: string | null): string {
4520 const location = node.startLine ? `:${node.startLine}` : '';

Callers 1

renderNodeSectionMethod · 0.95

Calls 2

joinMethod · 0.80
getChildrenMethod · 0.45

Tested by

no test coverage detected