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

Method buildContainerOutline

src/mcp/tools.ts:9128–9141  ·  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

9126 * has no indexed children, so the caller can fall back to full source.
9127 */
9128 private buildContainerOutline(cg: CodeGraph, node: Node): string {
9129 const children = cg.getChildren(node.id)
9130 .filter(c => c.kind !== 'import' && c.kind !== 'export')
9131 .sort((a, b) => (a.startLine ?? 0) - (b.startLine ?? 0));
9132 if (children.length === 0) return '';
9133
9134 const lines = [`**Members (${children.length}):**`, ''];
9135 for (const c of children) {
9136 const loc = c.startLine ? `:${c.startLine}` : '';
9137 const sig = c.signature ? ` — \`${c.signature}\`` : '';
9138 lines.push(`- ${c.name} (${c.kind})${loc}${sig}`);
9139 }
9140 return lines.join('\n');
9141 }
9142
9143 private formatNodeDetails(node: Node, code: string | null, outline?: string | null): string {
9144 const location = node.startLine ? `:${node.startLine}` : '';

Callers 1

renderNodeSectionMethod · 0.95

Calls 3

pushMethod · 0.80
getChildrenMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected