diff options
Diffstat (limited to 'packages/core/src/tools/grep.ts')
| -rw-r--r-- | packages/core/src/tools/grep.ts | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/packages/core/src/tools/grep.ts b/packages/core/src/tools/grep.ts index f7de190b..612291d5 100644 --- a/packages/core/src/tools/grep.ts +++ b/packages/core/src/tools/grep.ts @@ -213,7 +213,10 @@ export class GrepTool extends BaseTool<GrepToolParams, ToolResult> { {} as Record<string, GrepMatch[]>, ); - let llmContent = `Found ${matches.length} match(es) for pattern "${params.pattern}" in path "${searchDirDisplay}"${params.include ? ` (filter: "${params.include}")` : ''}:\n---\n`; + const matchCount = matches.length; + const matchTerm = matchCount === 1 ? 'match' : 'matches'; + + let llmContent = `Found ${matchCount} ${matchTerm} for pattern "${params.pattern}" in path "${searchDirDisplay}"${params.include ? ` (filter: "${params.include}")` : ''}:\n---\n`; for (const filePath in matchesByFile) { llmContent += `File: ${filePath}\n`; @@ -226,7 +229,7 @@ export class GrepTool extends BaseTool<GrepToolParams, ToolResult> { return { llmContent: llmContent.trim(), - returnDisplay: `Found ${matches.length} matche(s)`, + returnDisplay: `Found ${matchCount} ${matchTerm}`, }; } catch (error) { console.error(`Error during GrepLogic execution: ${error}`); |
