Fix grep and glob tools

This commit is contained in:
Alex Gleason committed 2026-01-21 21:45:30 -06:00
1 parent 2971a91fbb
commit bb28e71e50
2 files changed
+6 -2

No files matched your search

+2 -1
View File
@@ -51,7 +51,8 @@ export class GlobTool implements Tool<GlobParams> {
if (args.path) { if (args.path) {
// User explicitly specified a path parameter // User explicitly specified a path parameter
searchPath = join(this.cwd, args.path); // If path is absolute, use it directly; otherwise join with cwd
searchPath = args.path.startsWith('/') ? args.path : join(this.cwd, args.path);
pattern = args.pattern; pattern = args.pattern;
} else { } else {
// Parse the pattern to extract base directory // Parse the pattern to extract base directory
+4 -1
View File
@@ -48,7 +48,10 @@ export class GrepTool implements Tool<GrepParams> {
throw new Error("pattern is required"); throw new Error("pattern is required");
} }
const searchPath = args.path ? join(this.cwd, args.path) : this.cwd; // If path is absolute, use it directly; otherwise join with cwd
const searchPath = args.path
? (args.path.startsWith('/') ? args.path : join(this.cwd, args.path))
: this.cwd;
try { try {
// Check if search path exists // Check if search path exists