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

Method formatNodeDetails

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

Source from the content-addressed store, hash-verified

7011 }
7012
7013 private formatNodeDetails(node: Node, code: string | null, outline?: string | null): string {
7014 const location = node.startLine ? `:${node.startLine}` : '';
7015 const lines: string[] = [
7016 `**${node.name}** (${node.kind})`,
7017 '',
7018 `**Location:** ${node.filePath}${location}`,
7019 ];
7020
7021 if (node.signature) {
7022 lines.push(`**Signature:** \`${node.signature}\``);
7023 }
7024
7025 // Only include docstring if it's short and useful
7026 if (node.docstring && node.docstring.length < 200) {
7027 lines.push('', node.docstring);
7028 }
7029
7030 if (outline) {
7031 lines.push('', outline, '',
7032 `> Structural outline only. Read \`${node.filePath}\` or call codegraph_node on a specific member for its body.`);
7033 } else if (code) {
7034 // Line-numbered (cat -n style, like codegraph_explore and Read) so the
7035 // agent can cite/edit exact lines without re-Reading the file for them.
7036 const numbered = node.startLine ? numberSourceLines(code, node.startLine) : code;
7037 lines.push('', '```' + node.language, numbered, '```');
7038 }
7039
7040 return lines.join('\n');
7041 }
7042
7043 private textResult(text: string): ToolResult {
7044 return {

Callers 1

renderNodeSectionMethod · 0.95

Calls 2

numberSourceLinesFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected