一键导入
grep-files
Searches for a regex pattern across files in a directory tree, returning an array of matches with file paths, line numbers, and matched line content.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Searches for a regex pattern across files in a directory tree, returning an array of matches with file paths, line numbers, and matched line content.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
Checks whether a given path exists in the filesystem, returning a boolean result for both files and directories.
Copies a file from a source path to a destination path. The source file remains unchanged after the operation.
Removes a file or empty directory at the specified path. Recursive deletion and trash/recycle-bin moves are out of scope.
Replaces the first occurrence of old_string with new_string in a file.
Searches a directory tree recursively for files whose relative path matches a glob pattern, returning an array of absolute file paths.
Stages specified file paths or glob patterns for commit in a git repository.
基于 SOC 职业分类
| name | grep_files |
| version | 1.0.0 |
| author | clawthority |
| license | MIT-0 |
| description | Searches for a regex pattern across files in a directory tree, returning an array of matches with file paths, line numbers, and matched line content. |
| read_when | user asks to search file contents, find text in files, grep files, search for a pattern, find which files contain a string |
| action_class | filesystem.read |
You are the grep_files tool for Clawthority. You search for a regular expression pattern across files in a directory tree and return an array of matches with file paths, 1-based line numbers, and matched line content.
Invoke this tool when the user or agent wants to:
find_files for name-based)| Name | Type | Required | Description |
|---|---|---|---|
pattern | string | Yes | Regular expression pattern to search for in file contents. Supports standard JavaScript regex syntax. |
path | string | No | Absolute path of the directory to search. Defaults to the current working directory when omitted. |
glob | string | No | Optional glob pattern to restrict which files are searched. Supports *, **, ?, and {a,b} alternation. When omitted, all files are searched. |
| Name | Type | Description |
|---|---|---|
matches | GrepMatch[] | Array of matches found across all searched files. Empty array when nothing is found. |
| Field | Type | Description |
|---|---|---|
file | string | Absolute path of the file containing the match. |
line | number | 1-based line number of the matching line. |
content | string | Full text of the matching line (newline stripped). |
{
"tool": "grep_files",
"params": {
"pattern": "function grepFiles",
"path": "/project/src",
"glob": "**/*.ts"
}
}
{
"matches": [
{
"file": "/project/src/tools/grep_files/grep-files.ts",
"line": 42,
"content": "export function grepFiles(params: GrepFilesParams): GrepFilesResult {"
}
]
}
{
"tool": "grep_files",
"params": {
"pattern": "^import.*from",
"path": "/project/src",
"glob": "**/*.ts"
}
}
{
"tool": "grep_files",
"params": {
"pattern": "TODO",
"path": "/project"
}
}
| Error Code | Cause |
|---|---|
not-found | The specified path does not exist. |
not-a-dir | The specified path exists but is a file, not a directory. |
invalid-regex | The supplied pattern is not a valid regular expression. |
fs-error | An unexpected filesystem error occurred while accessing the path. |
Errors are thrown as GrepFilesError instances with a code discriminant.
This tool is classified as filesystem.read — a read-only operation that does not modify the filesystem. It is not subject to HITL gating.