Skip to content

Commit 3cf9a06

Browse files
feat: add search_files handler with excludePatterns support
1 parent ffd9cb7 commit 3cf9a06

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/filesystem/index.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -163,17 +163,16 @@ const server = new Server(
163163
},
164164
{
165165
capabilities: {
166-
tools: [
167-
{
168-
name: "search_files",
166+
tools: {
167+
search_files: {
169168
description: "Recursively search for files/directories with optional exclude patterns",
170169
inputSchema: zodToJsonSchema(SearchFilesArgsSchema),
171170
handler: async (args: z.infer<typeof SearchFilesArgsSchema>) => {
172171
const validatedPath = await validatePath(args.path);
173172
return searchFiles(validatedPath, args.pattern, args.excludePatterns);
174173
},
175174
},
176-
],
175+
},
177176
},
178177
},
179178
);
@@ -546,7 +545,7 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
546545
throw new Error(`Invalid arguments for search_files: ${parsed.error}`);
547546
}
548547
const validPath = await validatePath(parsed.data.path);
549-
const results = await searchFiles(validPath, parsed.data.pattern);
548+
const results = await searchFiles(validPath, parsed.data.pattern, parsed.data.excludePatterns);
550549
return {
551550
content: [{ type: "text", text: results.length > 0 ? results.join("\n") : "No matches found" }],
552551
};
@@ -568,9 +567,9 @@ server.setRequestHandler(CallToolRequestSchema, async (request) => {
568567

569568
case "list_allowed_directories": {
570569
return {
571-
content: [{
572-
type: "text",
573-
text: `Allowed directories:\n${allowedDirectories.join('\n')}`
570+
content: [{
571+
type: "text",
572+
text: `Allowed directories:\n${allowedDirectories.join('\n')}`
574573
}],
575574
};
576575
}

0 commit comments

Comments
 (0)