List Files
API Reference
List Files
List all Python files in the workspace
GET
List Files
Overview
Thelist-files resource returns a comprehensive list of all Python files in your workspace, including metadata about each file.
Resource URI
Request
string
required
Resource URI:
pylance://workspace/filesstring
Optional glob pattern to filter files (e.g.,
**/models/*.py)boolean
default:"true"
Include test files in the results
array
Array of glob patterns to exclude (e.g.,
["**/__pycache__/**", "**/node_modules/**"])Response
array
Array of file objects in the workspace
number
Total number of Python files
string
Absolute path to workspace root
Example Request
Example Response
Filter Patterns
Use glob patterns to filter results:Common Use Cases
Get All Source Files
Find All Test Files
Get Files by Directory
Performance Considerations
File listing is cached for 5 minutes. Changes to the workspace trigger automatic cache invalidation.
Optimization Tips
Use specific filter patterns to reduce result size
Exclude unnecessary directories (
__pycache__, .venv, node_modules)Cache results on the client side when possible
Use
includeTests=false if test files aren’t neededError Responses
Rate Limits
Related Resources
Read File
Read individual file contents
Workspace Structure
Get project structure overview