diff --git a/src/filesystem/README.md b/src/filesystem/README.md index c099da1e8c..664254b097 100644 --- a/src/filesystem/README.md +++ b/src/filesystem/README.md @@ -136,7 +136,7 @@ The server's directory access control follows this flow: - Fails if destination exists - **search_files** - - Recursively search for files/directories that match or do not match patterns + - Recursively search for files/directories by name or path, not file contents - Inputs: - `path` (string): Starting directory - `pattern` (string): Search pattern diff --git a/src/filesystem/__tests__/structured-content.test.ts b/src/filesystem/__tests__/structured-content.test.ts index 4b8f92b0a3..87d125052b 100644 --- a/src/filesystem/__tests__/structured-content.test.ts +++ b/src/filesystem/__tests__/structured-content.test.ts @@ -139,6 +139,14 @@ describe('structuredContent schema compliance', () => { }); describe('search_files (control - already working)', () => { + it('should describe name/path matching rather than content search', async () => { + const result = await client.listTools(); + const searchFiles = result.tools.find((tool) => tool.name === 'search_files'); + + expect(searchFiles?.description).toContain('by name or path'); + expect(searchFiles?.description).toContain('not file contents'); + }); + it('should return structuredContent.content as a string', async () => { const result = await client.callTool({ name: 'search_files', diff --git a/src/filesystem/index.ts b/src/filesystem/index.ts index 7b67e63e58..00dd02bc11 100644 --- a/src/filesystem/index.ts +++ b/src/filesystem/index.ts @@ -628,8 +628,8 @@ server.registerTool( { title: "Search Files", description: - "Recursively search for files and directories matching a pattern. " + - "The patterns should be glob-style patterns that match paths relative to the working directory. " + + "Recursively search for files and directories by name or path, not file contents. " + + "The patterns should be glob-style patterns that match paths relative to the search directory. " + "Use pattern like '*.ext' to match files in current directory, and '**/*.ext' to match files in all subdirectories. " + "Returns full paths to all matching items. Great for finding files when you don't know their exact location. " + "Only searches within allowed directories.",