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

Method buildContainerOutline

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

4888 * has no indexed children, so the caller can fall back to full source.
4889 */
4890 private buildContainerOutline(cg: CodeGraph, node: Node): string {
4891 const children = cg.getChildren(node.id)
4892 .filter(c => c.kind !== 'import' && c.kind !== 'export')
4893 .sort((a, b) => (a.startLine ?? 0) - (b.startLine ?? 0));
4894 if (children.length === 0) return '';
4895
4896 const lines = [`**Members (${children.length}):**`, ''];
4897 for (const c of children) {
4898 const loc = c.startLine ? `:${c.startLine}` : '';
4899 const sig = c.signature ? ` — \`${c.signature}\`` : '';
4900 lines.push(`- ${c.name} (${c.kind})${loc}${sig}`);
4901 }
4902 return lines.join('\n');
4903 }
4904
4905 private formatNodeDetails(node: Node, code: string | null, outline?: string | null): string {
4906 const location = node.startLine ? `:${node.startLine}` : '';

Callers 1

renderNodeSectionMethod · 0.95

Calls 2

getChildrenMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected