# Directory Tree

> Get a recursive tree view of files and directories as a JSON structure. Each entry includes 'name', 'type' (file/directory), and 'children' for directories. Files have no children array, while directories always have a children array (which may be empty). The output is formatted with 2-space indentation for readability. Only works within allowed directories.

- Skill: `xiaobai1017/directory-tree` (Agent Skill)
- Install (CLI): `npx skillmds@latest add xiaobai1017/directory-tree`
- Raw SKILL.md: https://api.skillmd.com/api/skills/xiaobai1017/directory-tree/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: xiaobai1017 (https://skillmd.com/u/xiaobai1017)
- Updated: 2026-09-22
- Page: https://skillmd.com/skills/xiaobai1017/directory-tree

---


# Directory Tree

Get a recursive tree view of files and directories as a JSON structure. Each entry includes 'name', 'type' (file/directory), and 'children' for directories. Files have no children array, while directories always have a children array (which may be empty). The output is formatted with 2-space indentation for readability. Only works within allowed directories.

## Purpose

This skill provides access to the MCP tool `directory_tree`. It allows you to get a recursive tree view of files and directories as a json structure. each entry includes 'name', 'type' (file/directory), and 'children' for directories. files have no children array, while directories always have a children array (which may be empty). the output is formatted with 2-space indentation for readability. only works within allowed directories..

## Parameters

The tool accepts the following parameters:

### `path`
**Required**
- **Type**: `string`
- **Description**: No description provided

### `excludePatterns`
*Optional*
- **Type**: `array`
- **Description**: No description provided


## Usage Instructions

To use this tool:

1. **Prepare the parameters** according to the schema above
2. **Invoke the MCP tool** `directory_tree` with the prepared parameters
3. **Process the result** returned by the tool

## Example

```json
{
  "path": "example_value",
  "excludePatterns": {}
}
```

## Expected Output

The tool returns data with the following structure:

- **content** (`string`): No description provided


## Notes

- This skill requires an active MCP connection to the server providing the `directory_tree` tool
- Ensure the MCP server is properly configured and running before attempting to use this tool
- Review the parameter requirements carefully to avoid errors
