Mew. Work. Docs

Built-in tools›Files and search

Search content

grep
Group
Files and search
Turned on by
Its own switch on the Tools page of Conversation settings.
Approval
Not reviewed: runs without asking, within the limits on this page.
Profile key
tool.grep.description

Searches file contents with a regular expression and reports where it matches: the files, the matching lines, or a count per file.

Matching works one line at a time, so a pattern cannot span lines. It is case-sensitive unless the model passes case_sensitive: false. The syntax has no look-around and no backreferences.

output_mode picks the answer:

  • files_with_matches, the default: the files with a match, newest first.
  • content: each matching line with its file and line number. context, before and after add 0 to 20 lines around every match.
  • count: the number of matching lines in each file, and the totals.

glob, such as *.rs or src/**/*.tsx, limits the search to the files it matches.

Limits

  • Binary files and links are skipped. A text file is searched whatever its size.
  • A call returns 250 results by default and at most 1,000 with limit; offset fetches the next page.
  • In content mode, each line shown, context lines included, is cut at 500 characters.
  • A result over 20,000 characters is saved to a file in Mewrk's app-data folder. The model gets the first 2,000 characters and the file's path.

Good to know

  • It searches what Git would show: tracked files, and untracked files Git does not ignore. Outside a Git repository, dependency and build folders such as node_modules and target are skipped. A single file named as path is always searched.
  • On a WSL or SSH machine whose grep has no --null option (BusyBox, for one), a call that asks for context gets none, and the result says so.
  • You can change a recorded grep call in the timeline and run it again with Rerun.

Parameters

ParameterTypeDetails
pattern required
Search pattern
string—
after
Lines after
integercontent mode only: lines of context to show after each match, 0 to 20.
before
Lines before
integercontent mode only: lines of context to show before each match, 0 to 20.
case_sensitive
Case sensitive
booleanDefault true
context
Context
integercontent mode only: lines of context to show before and after each match, 0 to 20.
glob
File glob
stringOnly search files whose path matches this glob, such as .rs or src/**/.tsx.
limit
Limit
integerMost results of the chosen mode to return: 250 by default, at most 1,000.
Default 250
offset
Offset
integerResults of the chosen mode to skip first, to fetch the next page.
Default 0
output_mode
Output mode
stringfiles_with_matches (default) lists the files that match; content lists the matching lines; count gives the number of matching lines per file.
"files_with_matches" "content" "count"
Default "files_with_matches"
path
Path
stringDefault "."