@@ -206,7 +206,7 @@ func (g *grepTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error)
206206 searchPath = g.workingDir
207207 }
208208
209− matches, truncated, err := searchFiles(searchPattern, searchPath, params.Include, 100)
209+ matches, truncated, err := searchFiles(ctx, searchPattern, searchPath, params.Include, 100)
210210 if err != nil {
211211 return ToolResponse{}, fmt.Errorf("error searching files: %w", err)
212212 }
@@ -247,8 +247,8 @@ func (g *grepTool) Run(ctx context.Context, call ToolCall) (ToolResponse, error)
247247 ), nil
248248}
249249
250−func searchFiles(pattern, rootPath, include string, limit int) ([]grepMatch, bool, error) {
251− matches, err := searchWithRipgrep(pattern, rootPath, include)
250+func searchFiles(ctx context.Context, pattern, rootPath, include string, limit int) ([]grepMatch, bool, error) {
251+ matches, err := searchWithRipgrep(ctx, pattern, rootPath, include)
252252 if err != nil {
253253 matches, err = searchFilesWithRegex(pattern, rootPath, include)
254254 if err != nil {
@@ -268,8 +268,8 @@ func searchFiles(pattern, rootPath, include string, limit int) ([]grepMatch, boo
268268 return matches, truncated, nil
269269}
270270
271−func searchWithRipgrep(pattern, path, include string) ([]grepMatch, error) {
272− cmd := fsext.GetRgSearchCmd(pattern, path, include)
271+func searchWithRipgrep(ctx context.Context, pattern, path, include string) ([]grepMatch, error) {
272+ cmd := fsext.GetRgSearchCmd(ctx, pattern, path, include)
273273 if cmd == nil {
274274 return nil, fmt.Errorf("ripgrep not found in $PATH")
275275 }