(node: Node, code: string | null, outline?: string | null)
| 4666 | } |
| 4667 | |
| 4668 | private formatNodeDetails(node: Node, code: string | null, outline?: string | null): string { |
| 4669 | const location = node.startLine ? `:${node.startLine}` : ''; |
| 4670 | const lines: string[] = [ |
| 4671 | `**${node.name}** (${node.kind})`, |
| 4672 | '', |
| 4673 | `**Location:** ${node.filePath}${location}`, |
| 4674 | ]; |
| 4675 | |
| 4676 | if (node.signature) { |
| 4677 | lines.push(`**Signature:** \`${node.signature}\``); |
| 4678 | } |
| 4679 | |
| 4680 | // Only include docstring if it's short and useful |
| 4681 | if (node.docstring && node.docstring.length < 200) { |
| 4682 | lines.push('', node.docstring); |
| 4683 | } |
| 4684 | |
| 4685 | if (outline) { |
| 4686 | lines.push('', outline, '', |
| 4687 | `> Structural outline only. Read \`${node.filePath}\` or call codegraph_node on a specific member for its body.`); |
| 4688 | } else if (code) { |
| 4689 | // Line-numbered (cat -n style, like codegraph_explore and Read) so the |
| 4690 | // agent can cite/edit exact lines without re-Reading the file for them. |
| 4691 | const numbered = node.startLine ? numberSourceLines(code, node.startLine) : code; |
| 4692 | lines.push('', '```' + node.language, numbered, '```'); |
| 4693 | } |
| 4694 | |
| 4695 | return lines.join('\n'); |
| 4696 | } |
| 4697 | |
| 4698 | private textResult(text: string): ToolResult { |
| 4699 | return { |
no test coverage detected