Skip to content

Commit b8ea5dc

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 fc5e6f4 commit b8ea5dc

File tree

2 files changed

+450
-92
lines changed

2 files changed

+450
-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`.
@@ -71,14 +72,27 @@ Node.js server implementing Model Context Protocol (MCP) for filesystem operatio
7172
- `destination` (string)
7273
- Fails if destination exists
7374

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

8397
- **get_file_info**
8498
- Get detailed file/directory metadata

0 commit comments

Comments
 (0)