Skip to content

Commit cc4103f

Browse files
Confusing search_files function description leads to misunderstanding of its purpose.
Rename "search_files" to search_files_by_name. Add new "search_file_contents" function. Add descriptions to help the LLM understand the fields. Support single file search.
1 parent 202f6c5 commit cc4103f

File tree

2 files changed

+374
-92
lines changed

2 files changed

+374
-92
lines changed

src/filesystem/README.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ Node.js server implementing Model Context Protocol (MCP) for filesystem operatio
77
- Read/write files
88
- Create/list/delete directories
99
- Move files/directories
10-
- Search files
10+
- Search for files by name
11+
- Search within file contents (grep-like functionality)
1112
- Get file metadata
1213

1314
**Note**: The server will only allow operations within directories specified via `args`.
@@ -77,14 +78,27 @@ Node.js server implementing Model Context Protocol (MCP) for filesystem operatio
7778
- `destination` (string)
7879
- Fails if destination exists
7980

80-
- **search_files**
81-
- Recursively search for files/directories
81+
- **search_files_by_name**
82+
- Find files and directories whose names match a pattern
8283
- Inputs:
8384
- `path` (string): Starting directory
84-
- `pattern` (string): Search pattern
85+
- `pattern` (string): Name pattern to match
8586
- `excludePatterns` (string[]): Exclude any patterns. Glob formats are supported.
8687
- Case-insensitive matching
87-
- Returns full paths to matches
88+
- Returns full paths to matching files/directories
89+
90+
- **search_file_contents**
91+
- Search for text patterns within file contents (similar to grep)
92+
- Inputs:
93+
- `path` (string): Starting directory
94+
- `pattern` (string): Text pattern to search for
95+
- `caseSensitive` (boolean): Enable case-sensitive search (default: false)
96+
- `maxResults` (number): Maximum number of results to return (default: 100)
97+
- `contextLines` (number): Number of context lines to show around matches (default: 2)
98+
- `excludePatterns` (string[]): Paths to exclude from search. Glob formats are supported.
99+
- `includeTypes` (string[]): Only search files with these extensions (e.g., ['js', 'ts'])
100+
- `excludeTypes` (string[]): Skip files with these extensions (e.g., ['jpg', 'png'])
101+
- Returns matching files with line numbers, matched text, and context
88102

89103
- **get_file_info**
90104
- Get detailed file/directory metadata

0 commit comments

Comments
 (0)