Skip to main content
Glama

listdir

List directory contents with configurable options for flat or tree-structured output, depth control, and token-efficient relative paths.

Instructions

Lists directory contents. Default: flat listing (one path per line, token-efficient for AI agents). Use flat=false for visual tree structure with connectors (├── └──). Skips hidden directories and common build/vendor directories. Use max_depth to control traversal depth (default: 3). Use relative_paths=true to show root as '.' instead of full path (saves tokens).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the directory to list
max_depthNoMaximum depth for tree traversal. Default: 3
relative_pathsNoShow the root as '.' instead of the full absolute path. Saves tokens in output. Default: false
flatNoFlat listing without tree connectors (one path per line). Default: true

Latest Blog Posts

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/knewstimek/agent-tool'

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