MCPcopy
hub / github.com/colbymchenry/codegraph / formatSearchResults

Method formatSearchResults

src/mcp/tools.ts:4422–4436  ·  view source on GitHub ↗
(results: SearchResult[])

Source from the content-addressed store, hash-verified

4420 // =========================================================================
4421
4422 private formatSearchResults(results: SearchResult[]): string {
4423 const lines: string[] = [`**Search Results (${results.length} found)**`, ''];
4424
4425 for (const result of results) {
4426 const { node } = result;
4427 const location = node.startLine ? `:${node.startLine}` : '';
4428 // Compact format: one line per result with key info
4429 lines.push(`**${node.name}** (${node.kind})`);
4430 lines.push(`${node.filePath}${location}`);
4431 if (node.signature) lines.push(`\`${node.signature}\``);
4432 lines.push('');
4433 }
4434
4435 return lines.join('\n');
4436 }
4437
4438 private formatNodeList(nodes: Node[], title: string, labels?: Map<string, string>): string {
4439 const lines: string[] = [`**${title} (${nodes.length} found)**`, ''];

Callers 1

handleSearchMethod · 0.95

Calls 1

joinMethod · 0.80

Tested by

no test coverage detected