Skip to content

Commit 414e615

Browse files
committed
fix: add workspace directory context to codebase_search path parameter
- Added ToolArgs import and parameter to getCodebaseSearchDescription function - Updated path parameter description to include '(relative to the current workspace directory ${args.cwd})' - Updated index.ts to pass args to getCodebaseSearchDescription - Maintains consistency with other tool descriptions like list_files and search_files
1 parent 04ae395 commit 414e615

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

src/core/prompts/tools/codebase-search.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
export function getCodebaseSearchDescription(): string {
1+
import { ToolArgs } from "./types"
2+
3+
export function getCodebaseSearchDescription(args: ToolArgs): string {
24
return `## codebase_search
35
Description: Find files most relevant to the search query using semantic search. Searches based on meaning rather than exact text matches. By default searches entire workspace. Reuse the user's exact wording unless there's a clear reason not to - their phrasing often helps semantic search. Queries MUST be in English (translate if needed).
46
57
Parameters:
68
- query: (required) The search query. Reuse the user's exact wording/question format unless there's a clear reason not to.
7-
- path: (optional) Limit search to specific subdirectory. Leave empty for entire workspace.
9+
- path: (optional) Limit search to specific subdirectory (relative to the current workspace directory ${args.cwd}). Leave empty for entire workspace.
810
911
Usage:
1012
<codebase_search>

src/core/prompts/tools/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ const toolDescriptionMap: Record<string, (args: ToolArgs) => string | undefined>
3939
attempt_completion: (args) => getAttemptCompletionDescription(args),
4040
use_mcp_tool: (args) => getUseMcpToolDescription(args),
4141
access_mcp_resource: (args) => getAccessMcpResourceDescription(args),
42-
codebase_search: () => getCodebaseSearchDescription(),
42+
codebase_search: (args) => getCodebaseSearchDescription(args),
4343
switch_mode: () => getSwitchModeDescription(),
4444
new_task: (args) => getNewTaskDescription(args),
4545
insert_content: (args) => getInsertContentDescription(args),

0 commit comments

Comments
 (0)