mirror of
https://github.com/modelcontextprotocol/servers.git
synced 2026-04-18 16:13:22 +02:00
Support glob pattern in search_files tool (#745)
Co-authored-by: Adam Jones <adamj+git@anthropic.com> Co-authored-by: Claude <noreply@anthropic.com> Co-authored-by: Adam Jones <adamj@anthropic.com>
This commit is contained in:
@@ -367,14 +367,14 @@ export async function searchFilesWithValidation(
|
||||
await validatePath(fullPath);
|
||||
|
||||
const relativePath = path.relative(rootPath, fullPath);
|
||||
const shouldExclude = excludePatterns.some(excludePattern => {
|
||||
const globPattern = excludePattern.includes('*') ? excludePattern : `**/${excludePattern}/**`;
|
||||
return minimatch(relativePath, globPattern, { dot: true });
|
||||
});
|
||||
const shouldExclude = excludePatterns.some(excludePattern =>
|
||||
minimatch(relativePath, excludePattern, { dot: true })
|
||||
);
|
||||
|
||||
if (shouldExclude) continue;
|
||||
|
||||
if (entry.name.toLowerCase().includes(pattern.toLowerCase())) {
|
||||
// Use glob matching for the search pattern
|
||||
if (minimatch(relativePath, pattern, { dot: true })) {
|
||||
results.push(fullPath);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user