adb_grep
Search file contents on Android devices by text pattern using fixed-string or regex matching. Supports recursive search, depth control, and result capping.
Instructions
Search file contents on the device by text pattern. Uses fixed-string matching by default (no regex injection risk). Supports recursive directory search with depth control and result capping. For filename searches, use adb_find instead.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| pattern | Yes | Text pattern to search for | |
| path | Yes | File or directory path to search | |
| recursive | No | Search directories recursively | |
| fixedString | No | Use fixed-string matching (default: true, safer). Set false for regex. | |
| ignoreCase | No | Case-insensitive search (default: true) | |
| maxResults | No | Maximum matching lines to return (1-10000, default 500) | |
| maxDepth | No | Maximum directory depth for recursive search (1-50, default 10) | |
| filesWithMatches | No | Show only filenames that contain matches, not the matching lines | |
| root | No | Use root shell for protected paths | |
| device | No | Device serial |