Skip to content

Grep

Search file content via ripgrep. Returns matches in the chosen output mode.

ParamTypeRequiredDefaultNotes
patternstringyesRust regex syntax (ripgrep’s engine).
pathstringnoworkspace rootFile or directory to search.
globstringnoFile filter, e.g. "*.go".
case_insensitivebooleannofalseAdds -i.
output_modestringno"content"One of "content", "files_with_matches", "count".
head_limitnumbernounlimitedTruncate output to this many lines. 0 means no limit.
  • content — one match per line: path:line:text
  • files_with_matches — one path per line (files that have at least one match)
  • count — one line per file: path:count
  • .gitignore is honored (via rg --no-require-git so it works outside a git repo too).
  • Always runs with cwd = workspace root, so paths in output are workspace-relative.
  • Invalid regex returns an error result wrapping ripgrep’s stderr.
  • No matches returns an empty text result (not an error).
  • head_limit is applied client-side after ripgrep returns; for count and files_with_matches it bounds the number of files reported.

Pattern: TODO, output mode: content, glob: *.go

cmd/sandbox/main.go:42:// TODO: handle signal cleanup
internal/tools/bash.go:120:// TODO: consider per-shell max-runtime
  • Glob — search file paths.
  • Read — after finding a match, read the surrounding lines.