Skip to content

Commit e520b06

Browse files
committed
optimize code context mcp output format
Signed-off-by: ChengZi <chen.zhang@zilliz.com>
1 parent 85ce0d6 commit e520b06

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/mcp/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -653,14 +653,14 @@ class CodeIndexerMcpServer {
653653

654654
// Format results
655655
const formattedResults = searchResults.map((result: any, index: number) => {
656-
const location = `${result.relativePath}:${result.startLine}`;
657-
const context = this.truncateContent(result.content, 150);
656+
const location = `${result.relativePath}:${result.startLine}-${result.endLine}`;
657+
const context = this.truncateContent(result.content, 5000);
658658
const codebaseInfo = path.basename(absolutePath);
659659

660660
return `${index + 1}. Code snippet (${result.language}) [${codebaseInfo}]\n` +
661661
` Location: ${location}\n` +
662662
` Score: ${result.score.toFixed(3)}\n` +
663-
` Context: ${context}\n`;
663+
` Context: \n\`\`\`${result.language}\n${context}\n\`\`\`\n`;
664664
}).join('\n');
665665

666666
return {

0 commit comments

Comments
 (0)