file_search
Search file contents within directories using regex patterns, with file type filtering, depth limits, timeout controls, and ignore patterns for targeted results.
Instructions
文件内容搜索:在目录中搜索匹配正则表达式的内容。支持文件类型过滤、深度限制、超时控制和忽略模式。
示例:搜索 JS 文件中的函数定义 { "search_path": "src", "pattern": "function\s+\w+", "file_types": "js,ts" } 示例:忽略 node_modules 搜索 { "search_path": ".", "pattern": "TODO", "ignore": ["node_modules", "*.log"] }
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| search_path | Yes | 搜索起始目录路径 | |
| pattern | Yes | 正则表达式搜索模式 | |
| file_types | No | 逗号分隔的文件扩展名列表,如 "js,ts,json" | |
| case_sensitive | No | 是否区分大小写搜索 | |
| max_results | No | 最大结果数量,超过会截断,默认100 | |
| max_depth | No | 最大递归深度,0表示不递归,默认8 | |
| timeout_ms | No | 超时时间(毫秒),防止命令长时间阻塞,默认60000 | |
| ignore | No | 要忽略的文件/目录模式列表,支持通配符如 "*.log"、"node_modules" | |
| output_format | No | 输出格式:text(纯文本)、json(结构化JSON)、both(两者兼有) |