mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-18 16:13:22 +02:00
feat(search_files): clarify description and standardise implementation
Previously description was confusing/ambigious about whether this was doing text content matching or filename matching. This clarifies it's by filename. Also the implementation for globs was confusing - it would sometimes use glob and sometimes substring match. This makes it all globs. Fixes #896 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -350,7 +350,7 @@ export async function headFile(filePath: string, numLines: number): Promise<stri
|
||||
|
||||
export async function searchFilesWithValidation(
|
||||
rootPath: string,
|
||||
pattern: string,
|
||||
patterns: string[],
|
||||
allowedDirectories: string[],
|
||||
options: SearchOptions = {}
|
||||
): Promise<string[]> {
|
||||
@@ -373,8 +373,12 @@ export async function searchFilesWithValidation(
|
||||
|
||||
if (shouldExclude) continue;
|
||||
|
||||
// Use glob matching for the search pattern
|
||||
if (minimatch(relativePath, pattern, { dot: true })) {
|
||||
// Check if the path matches any of the patterns
|
||||
const matches = patterns.some(pattern =>
|
||||
minimatch(relativePath, pattern, { dot: true })
|
||||
);
|
||||
|
||||
if (matches) {
|
||||
results.push(fullPath);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user