(node: Node, code: string | null, outline?: string | null)
| 9141 | } |
| 9142 | |
| 9143 | private formatNodeDetails(node: Node, code: string | null, outline?: string | null): string { |
| 9144 | const location = node.startLine ? `:${node.startLine}` : ''; |
| 9145 | const lines: string[] = [ |
| 9146 | `**${node.name}** (${node.kind})`, |
| 9147 | '', |
| 9148 | `**Location:** ${node.filePath}${location}`, |
| 9149 | ]; |
| 9150 | |
| 9151 | if (node.signature) { |
| 9152 | lines.push(`**Signature:** \`${node.signature}\``); |
| 9153 | } |
| 9154 | |
| 9155 | // Only include docstring if it's short and useful |
| 9156 | if (node.docstring && node.docstring.length < 200) { |
| 9157 | lines.push('', node.docstring); |
| 9158 | } |
| 9159 | |
| 9160 | if (outline) { |
| 9161 | lines.push('', outline, '', |
| 9162 | `> Structural outline only. Read \`${node.filePath}\` or call codegraph_node on a specific member for its body.`); |
| 9163 | } else if (code) { |
| 9164 | // Line-numbered (cat -n style, like codegraph_explore and Read) so the |
| 9165 | // agent can cite/edit exact lines without re-Reading the file for them. |
| 9166 | const numbered = node.startLine ? numberSourceLines(code, node.startLine) : code; |
| 9167 | lines.push('', '```' + node.language, numbered, '```'); |
| 9168 | } |
| 9169 | |
| 9170 | return lines.join('\n'); |
| 9171 | } |
| 9172 | |
| 9173 | private textResult(text: string): ToolResult { |
| 9174 | return { |
no test coverage detected