diff --git a/src/tools/glob/tools.ts b/src/tools/glob/tools.ts index 763a3fd4b..2d8b491ed 100644 --- a/src/tools/glob/tools.ts +++ b/src/tools/glob/tools.ts @@ -20,11 +20,11 @@ export const glob: ToolDefinition = tool({ "simply omit it for the default behavior. Must be a valid directory path if provided." ), }, - execute: async (args, ctx) => { + execute: async (args) => { try { const cli = await resolveGrepCliWithAutoInstall() - // Use ctx.directory as the default search path when no path is provided - const searchPath = args.path ?? ctx.directory + // Use process.cwd() as the default search path when no path is provided + const searchPath = args.path ?? process.cwd() const paths = [searchPath] const result = await runRgFiles( diff --git a/src/tools/grep/tools.ts b/src/tools/grep/tools.ts index 7e8f5faa8..901764ce7 100644 --- a/src/tools/grep/tools.ts +++ b/src/tools/grep/tools.ts @@ -20,11 +20,11 @@ export const grep: ToolDefinition = tool({ .optional() .describe("The directory to search in. Defaults to the current working directory."), }, - execute: async (args, ctx) => { + execute: async (args) => { try { const globs = args.include ? [args.include] : undefined - // Use ctx.directory as the default search path when no path is provided - const searchPath = args.path ?? ctx.directory + // Use process.cwd() as the default search path when no path is provided + const searchPath = args.path ?? process.cwd() const paths = [searchPath] const result = await runRg({