(node: Node, code: string | null, outline?: string | null)
| 9314 | } |
| 9315 | |
| 9316 | private formatNodeDetails(node: Node, code: string | null, outline?: string | null): string { |
| 9317 | const location = node.startLine ? `:${node.startLine}` : ''; |
| 9318 | const lines: string[] = [ |
| 9319 | `**${node.name}** (${node.kind})`, |
| 9320 | '', |
| 9321 | `**Location:** ${node.filePath}${location}`, |
| 9322 | ]; |
| 9323 | |
| 9324 | if (node.signature) { |
| 9325 | lines.push(`**Signature:** \`${node.signature}\``); |
| 9326 | } |
| 9327 | |
| 9328 | // Only include docstring if it's short and useful |
| 9329 | if (node.docstring && node.docstring.length < 200) { |
| 9330 | lines.push('', node.docstring); |
| 9331 | } |
| 9332 | |
| 9333 | if (outline) { |
| 9334 | lines.push('', outline, '', |
| 9335 | `> Structural outline only. Read \`${node.filePath}\` or call codegraph_node on a specific member for its body.`); |
| 9336 | } else if (code) { |
| 9337 | // Line-numbered (cat -n style, like codegraph_explore and Read) so the |
| 9338 | // agent can cite/edit exact lines without re-Reading the file for them. |
| 9339 | const numbered = node.startLine ? numberSourceLines(code, node.startLine) : code; |
| 9340 | lines.push('', '```' + node.language, numbered, '```'); |
| 9341 | } |
| 9342 | |
| 9343 | return lines.join('\n'); |
| 9344 | } |
| 9345 | |
| 9346 | private textResult(text: string): ToolResult { |
| 9347 | return { |
no test coverage detected