Fix behaviour of search_files tool #745
Open
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_files
tool currently has inconsistent and unexpected behaviour.Issue: #735
Description
For some reason, glob pattern matching was only supported for
excludePatterns
argument 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:
pattern
argument. The full relative path to each item is checked (not just the item name like before), so a pattern like**/*.ext
is required to recursively match files in sub-directoriesexcludePatterns
patterns to**//**
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
pattern
andexcludePatterns
Breaking Changes
Possibly, there is a change in behaviour (not change in tool interface).
Types of changes
Checklist