Add recursive directory listing to list_files tool#14
Merged
Conversation
Default recursive=true so callers see the full tree under the base directory in a single call. Directories are still emitted as entries with type='directory', and each entry now carries a 'path' field relative to the listed root. Adds max_depth and skips directory symlinks to avoid cycles.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Enhanced the
list_filestool to support recursive directory traversal with optional depth limiting, and improved the entry structure to include relative paths.Key Changes
recursiveparameter (defaultTrue) controls whether subdirectories are traversedmax_depthparameter allows limiting recursion depth (e.g.,max_depth=1for immediate children only)pathfield with the relative path from the listed directory (using/as separator), in addition to the existingnamefieldImplementation Details
_walk()helper function that respects depth limitsentry.is_dir() and not entry.is_symlink()) to prevent following circular symlink referencesrecursiveparameter value for clarityserver.pyupdated with proper parameter definitions and descriptionshttps://claude.ai/code/session_012AkYGvzYkJzN7f2VEN3wUn