Tools · Files and code

grep_files

Read-only

Search file contents in the local project using ripgrep when available.

When to use: Use this to find symbols, error strings, config keys, query fragments, and code references across the project.

Example

Run for real by scripts/tool-examples.py in a small demo project, with Haiku 5.5 where the tool calls a model. The output is exactly what the tool returned.

The call

tool call
{
  "tool": "grep_files",
  "arguments": {
    "pattern": "def ",
    "glob": "*.py"
  }
}

Real output

tests/test_pricing.py:4:def test_team():
src/pricing.py:6:def price(plan: str, seats: int) -> float:

Parameters

NameTypeDescription
pattern*stringRegex or plain-text pattern to search for
pathstringOptional relative directory to search from
globstringOptional glob filter such as *.py
limitnumberMaximum number of matching lines to return
case_sensitivebooleanWhether the search should be case-sensitive

* required

Read, search and edit the project; run commands, code and git.