Skip to main content
Glama

Filesystem MCP Server

directory_tree

Generate a recursive JSON tree structure of a directory, organizing files and subdirectories into a nested format with 'name', 'type', and 'children' fields. Ideal for visualizing directory hierarchies programmatically.

Instructions

Generate a recursive JSON tree structure of a directory.

Args: path (str): Directory path to generate tree for (absolute or relative to allowed directories)

Returns: str: JSON representation of directory tree with 2-space indentation, or error message if failed

Note: - Path must be within allowed directory roots - Returns nested structure with 'name', 'type', and 'children' fields - Types are either 'directory' or 'file' - Directories include 'children' array, files do not

Input Schema

NameRequiredDescriptionDefault
pathYes

Input Schema (JSON Schema)

{ "properties": { "path": { "title": "Path", "type": "string" } }, "required": [ "path" ], "type": "object" }
Install Server

Other Tools from Filesystem MCP Server

Related Tools

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Preston-Harrison/fs-mcp-py'

If you have feedback or need assistance with the MCP directory API, please join our Discord server