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

Method formatNodeDetails

src/mcp/tools.ts:9565–9593  ·  view source on GitHub ↗
(node: Node, code: string | null, outline?: string | null)

Source from the content-addressed store, hash-verified

9563 }
9564
9565 private formatNodeDetails(node: Node, code: string | null, outline?: string | null): string {
9566 const location = node.startLine ? `:${node.startLine}` : '';
9567 const lines: string[] = [
9568 `**${node.name}** (${node.kind})`,
9569 '',
9570 `**Location:** ${node.filePath}${location}`,
9571 ];
9572
9573 if (node.signature) {
9574 lines.push(`**Signature:** \`${node.signature}\``);
9575 }
9576
9577 // Only include docstring if it's short and useful
9578 if (node.docstring && node.docstring.length < 200) {
9579 lines.push('', node.docstring);
9580 }
9581
9582 if (outline) {
9583 lines.push('', outline, '',
9584 `> Structural outline only. Read \`${node.filePath}\` or call codegraph_node on a specific member for its body.`);
9585 } else if (code) {
9586 // Line-numbered (cat -n style, like codegraph_explore and Read) so the
9587 // agent can cite/edit exact lines without re-Reading the file for them.
9588 const numbered = node.startLine ? numberSourceLines(code, node.startLine) : code;
9589 lines.push('', '```' + node.language, numbered, '```');
9590 }
9591
9592 return lines.join('\n');
9593 }
9594
9595 private textResult(text: string): ToolResult {
9596 return {

Callers 1

renderNodeSectionMethod · 0.95

Calls 3

numberSourceLinesFunction · 0.85
pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected