directory_tree
Generate and visualize a recursive directory structure with customizable depth, file inclusion, and pattern filtering. Supports text or JSON output for clear file hierarchy representation.
Instructions
Get a recursive tree view of files and directories.
Args:
path: Root directory
max_depth: Maximum recursion depth
include_files: Whether to include files (not just directories)
pattern: Optional glob pattern to filter entries
exclude_patterns: Optional patterns to exclude
format: Output format ('text' or 'json')
ctx: MCP context
Returns:
Formatted directory tree
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| exclude_patterns | No | ||
| format | No | text | |
| include_files | No | ||
| max_depth | No | ||
| path | Yes | ||
| pattern | No |