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

Method formatNodeDetails

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

Source from the content-addressed store, hash-verified

9288 }
9289
9290 private formatNodeDetails(node: Node, code: string | null, outline?: string | null): string {
9291 const location = node.startLine ? `:${node.startLine}` : '';
9292 const lines: string[] = [
9293 `**${node.name}** (${node.kind})`,
9294 '',
9295 `**Location:** ${node.filePath}${location}`,
9296 ];
9297
9298 if (node.signature) {
9299 lines.push(`**Signature:** \`${node.signature}\``);
9300 }
9301
9302 // Only include docstring if it's short and useful
9303 if (node.docstring && node.docstring.length < 200) {
9304 lines.push('', node.docstring);
9305 }
9306
9307 if (outline) {
9308 lines.push('', outline, '',
9309 `> Structural outline only. Read \`${node.filePath}\` or call codegraph_node on a specific member for its body.`);
9310 } else if (code) {
9311 // Line-numbered (cat -n style, like codegraph_explore and Read) so the
9312 // agent can cite/edit exact lines without re-Reading the file for them.
9313 const numbered = node.startLine ? numberSourceLines(code, node.startLine) : code;
9314 lines.push('', '```' + node.language, numbered, '```');
9315 }
9316
9317 return lines.join('\n');
9318 }
9319
9320 private textResult(text: string): ToolResult {
9321 return {

Callers 1

renderNodeSectionMethod · 0.95

Calls 3

numberSourceLinesFunction · 0.85
pushMethod · 0.80
joinMethod · 0.45

Tested by

no test coverage detected