-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Fix behaviour of search_files tool #745
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
domdomegg
merged 7 commits into
modelcontextprotocol:main
from
Finndersen:fix_search_files
Aug 23, 2025
Merged
Fix behaviour of search_files tool #745
domdomegg
merged 7 commits into
modelcontextprotocol:main
from
Finndersen:fix_search_files
Aug 23, 2025
+14
−14
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Finndersen
commented
Mar 5, 2025
Resolved merge conflicts while preserving glob pattern functionality for search_files. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Keep only the core glob pattern functionality for search_files. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
domdomegg
previously approved these changes
Aug 15, 2025
pcarleton
previously approved these changes
Aug 18, 2025
- Use minimatch for pattern matching instead of substring matching - Remove automatic conversion of excludePatterns to **/<pattern>/** format - Both pattern and excludePatterns now use consistent glob matching
Tests now use '*test*' pattern instead of 'test' to match the new glob-based search behavior
domdomegg
approved these changes
Aug 23, 2025
27 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
bug
Something isn't working
server-filesystem
Reference implementation for the Filesystem MCP server - src/filesystem
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The
search_filestool currently has inconsistent and unexpected behaviour.Issue: #735
Description
For some reason, glob pattern matching was only supported for
excludePatternsargument and notpatterns, which is unexpected and causes LLMs to get confused and waste a lot of tokens and request cycles figuring out how to use the tool.This change improves and standardises the behaviour by:
patternargument. The full relative path to each item is checked (not just the item name like before), so a pattern like**/*.extis required to recursively match files in sub-directoriesexcludePatternspatterns to**/<pattern>/**format when no wildcard (*) providedServer Details
Motivation and Context
See above
How Has This Been Tested?
Tested directly and with Gemini model, with many combinations of
patternandexcludePatternsBreaking Changes
Possibly, there is a change in behaviour (not change in tool interface).
Types of changes
Checklist