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

Method buildContainerOutline

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

9273 * has no indexed children, so the caller can fall back to full source.
9274 */
9275 private buildContainerOutline(cg: CodeGraph, node: Node): string {
9276 const children = cg.getChildren(node.id)
9277 .filter(c => c.kind !== 'import' && c.kind !== 'export')
9278 .sort((a, b) => (a.startLine ?? 0) - (b.startLine ?? 0));
9279 if (children.length === 0) return '';
9280
9281 const lines = [`**Members (${children.length}):**`, ''];
9282 for (const c of children) {
9283 const loc = c.startLine ? `:${c.startLine}` : '';
9284 const sig = c.signature ? ` — \`${c.signature}\`` : '';
9285 lines.push(`- ${c.name} (${c.kind})${loc}${sig}`);
9286 }
9287 return lines.join('\n');
9288 }
9289
9290 private formatNodeDetails(node: Node, code: string | null, outline?: string | null): string {
9291 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