target parameter.
The Agent prefers this tool over running grep / find in the terminal: it returns structured results, skips dependency directories automatically, and works the same on Windows.
Dependencies
No extra dependencies, available by default. If ripgrep (rg) is installed it is used automatically for faster searches.
Parameters
Searching contents
The default mode. Returns the file, line number and line text for each match:output_mode=files cuts the output down substantially.
Finding files
Withtarget=files, pattern is matched against the file name, and results are ordered most-recently-modified first - when several files match, the one just worked on is usually the one wanted:
* or ?) is treated as a contains-match, so ai-news is equivalent to *ai-news* and you do not need to recall the full name.
Finding a file by name requires
target=files. A content search for report.md only finds files that mention that name, not the file itself.Excluded directories
These directories are always skipped so results are not drowned out by dependencies and build output:.git, node_modules, __pycache__, .venv, venv, .mypy_cache, .pytest_cache, dist, build, .next, target, vendor, .tox, coverage, .idea.
In addition, files ignored by .gitignore are skipped when ripgrep is installed.
When you do need to search them (inspecting third-party sources, for example), no_ignore=true lifts both kinds of exclusion at once. If a search returns nothing and such a directory happened to be skipped, the result carries a notice naming which ones.
Use Cases
- Locate a function, config key or error message in the codebase
- Find a document, report or web page generated earlier, by name
- Count how many times a pattern occurs in the project
