search_code
Search a directory tree line by line for a JavaScript regular expression, such as a permission string or URL in decompiled output. Returns file, line, and trimmed matching text.
Instructions
Search a directory tree for a regular expression, line by line - e.g. a permission string or URL in decompiled output. Only reads files; skips files over 2 MB, and has a 10-second limit so a pathological regex errors instead of hanging. Returns { dirPath, filesScanned, matchCount, matches: [{ file, line, text, name }], truncated } where file is relative to dirPath, line is 1-based, text is the trimmed matching line (max 300 chars), and name is always "match". To look specifically for hardcoded credentials use scan_secrets instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| dirPath | Yes | Absolute path of the directory to search. Must exist. | |
| pattern | Yes | A JavaScript regular expression tested against each line, e.g. "android\\.permission\\.[A-Z_]+". An invalid regex is rejected with an error. | |
| workspace | No | Workspace name (not id). Created if it doesn't exist, and this call is recorded as a job in its history. Defaults to "default". | |
| extensions | No | Only search files with these extensions - lowercase, with the leading dot, e.g. [".java", ".xml"]. Omit to search every file except known binary types (.apk, .dex, .zip, .jar, .so, images, fonts). | |
| maxResults | No | Stop after this many matches. Default and maximum 200. | |
| caseSensitive | No | Default false (case-insensitive). |