Skip to main content
Glama

listdir

List directory contents with flat or tree view. Control traversal depth, skip hidden directories, and show relative paths to save tokens.

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
pathNoAbsolute path to the directory to list
file_pathNoAlias for path
max_depthNoMaximum depth for tree traversal. Default: 3
relative_pathsNoShow the root as '.' instead of the full absolute path. Saves tokens in output: true or false. Default: false
flatNoFlat listing without tree connectors (one path per line). Default: true
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description discloses skipping hidden and build/vendor directories, default flat listing, max_depth default, and relative_paths token savings. It does not cover error handling or permissions, but the key behaviors are transparent.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Six sentences total. The first sentence states purpose, followed by concise parameter guidance. No redundant or filler content. Front-loaded with most important info.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no output schema, the description explains output formats (flat vs tree). It covers all parameters, default values, and behavioral notes (skipping dirs). Missing error handling or permissions, but sufficient for typical usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, so baseline is 3. The description adds value by explaining defaults (flat, max_depth, relative_paths) and the token-efficiency rationale, improving semantic understanding beyond parameter names.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description begins with 'Lists directory contents,' a clear verb+resource pair. It distinguishes from sibling tools like glob, grep, and file_info by focusing on listing directory contents with optional tree structure.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains default behavior (flat listing) and when to use alternatives (flat=false for tree, relative_paths to save tokens). It provides context on token efficiency and traversal depth but lacks explicit when-not-to-use or alternative tool references.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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