list_files
The list_files tool displays files and directories under a specified path, helping VJSP understand project structure and achieve efficient navigation of the codebase.
Parameter Description
This tool supports the following parameter configurations:
path(required): Directory path for listing content, relative to the current working directoryrecursive(optional): Whether to list files recursively. When set totrue, recursive listing is enabled; when set tofalseor omitted, only top-level content is listed
Feature Overview
This tool can list all files and directories under a specified path, clearly presenting the project structure. It supports two display modes: displaying only top-level directory content, or recursively traversing all subdirectories and displaying their content.
Applicable Scenarios
- When VJSP needs to understand the overall project structure
- When VJSP needs to check available file listings before reading specific files
- When VJSP needs to map the codebase to further understand its organizational architecture
- As a preparatory operation before using precise tools such as
read_file,search_files - When VJSP needs to search for specific types of files (e.g., configuration files) within the project
Core Features
- Lists both files and directories simultaneously, with clear directory identification
- Supports both recursive and non-recursive file listing modes
- In recursive mode, intelligently ignores common large directories such as
node_modules,.git, etc. - In recursive mode, follows
.gitignoreconfiguration rules - When
showVJSPIgnoredFilesis enabled, files ignored by.vjspignoreare marked with a lock icon (🔒) - Employs layer-by-layer directory traversal to optimize tool performance
- Sorts results, with directories displayed before their internal content to maintain logical hierarchy
- Presents listing results in a clean and organized format
- Automatically establishes logical mapping of project structure
Limitations
- To avoid performance issues, file listing results are limited to approximately 200 files by default
- Directory traversal has a 10-second timeout mechanism to prevent process hanging in complex directory structures
- When the file count limit is reached, a prompt is provided suggesting to execute
list_fileson specific subdirectories - Not suitable for use as a validation tool to verify whether newly created files exist
- Performance may degrade when running in very large directory structures
- For security reasons, files under the root directory or user home directory cannot be listed
Workflow
After calling the list_files tool, the following workflow is executed:
Parameter Validation: Validates the validity of the required parameter
pathand the optional parameterrecursivePath Resolution: Resolves relative paths to absolute paths
Security Validation: Prohibits listing files under sensitive paths such as the root directory or user home directory
Directory Scanning:
- Non-recursive mode: Only lists top-level directory content
- Recursive mode: Traverses directory structure layer by layer, with a 10-second timeout
- If timeout is triggered, returns partial results collected up to the timeout
Result Filtering:
- In recursive mode, skips common large directories such as
node_modules,.git, etc. - In recursive mode, follows
.gitignoreconfiguration rules - Parses
.vjspignorefiltering rules and performs hiding or lock marking operations on matched files
- In recursive mode, skips common large directories such as
Result Formatting:
- Adds trailing slash (
/) to identify directories - Sorts results, with directories displayed before their internal content to ensure logical hierarchy
- When
showVJSPIgnoredis enabled, marks ignored files with a lock icon (🔒) - By default, limits results to 200 files while providing prompts for individual subdirectory queries
- Formats results neatly to enhance readability
- Adds trailing slash (
Result Display Format
File listing results conform to the following specifications:
- Each file path is displayed on a separate line
- Directories are identified with a trailing slash (
/) - When
showVJSPIgnoredis enabled, files ignored by.vjspignoreare marked with a lock icon (🔒) - Results are sorted logically, with directories displayed before their internal content
- When the file count limit is reached, a prompt appears suggesting to execute
list_fileson specific subdirectories
Result display example:
src/
src/components/
src/components/Button.tsx
src/components/Header.tsx
src/utils/
src/utils/helpers.ts
src/index.ts
...
File listing results truncated (543 total files, currently displaying 200). Execute list_files on specific subdirectories to view complete content.Display example when .vjspignore is enabled and showVJSPIgnored is turned on:
src/
src/components/
src/components/Button.tsx
src/components/Header.tsx
🔒 src/secrets.json
src/utils/
src/utils/helpers.ts
src/index.tsReal-World Application Scenarios
- When starting a new task, VJSP will first list project files and understand the overall structure before processing specific code in depth
- When receiving instructions to search for specific types of files (e.g., all JavaScript files), VJSP will first list directories to determine the search scope
- Before providing code organization optimization suggestions, VJSP will first analyze the structural layout of the current project
- When building new feature modules, VJSP will list relevant directories to adapt to the project's development standards
Usage Examples
List top-level files in the current directory:
<list_files>
<path>.</path>
</list_files>Recursively list all files in the source directory:
<list_files>
<path>src</path>
<recursive>true</recursive>
</list_files>View contents of a specific project subdirectory:
<list_files>
<path>src/components</path>
<recursive>false</recursive>
</list_files>