Skip to main content
Glama
wonderwhy-er

Claude Desktop Commander MCP

by wonderwhy-er

list_directory

Read-only

Get a detailed listing of all files and directories in a specified path.

Instructions

                    Get a detailed listing of all files and directories in a specified path.
                    
                    Returns a structured directory listing without starting a shell command.
                    Results distinguish between files and directories with [FILE] and [DIR] prefixes.
                    
                    Supports recursive listing with the 'depth' parameter (default: 2):
                    - depth=1: Only direct contents of the directory
                    - depth=2: Contents plus one level of subdirectories
                    - depth=3+: Multiple levels deep
                    
                    CONTEXT OVERFLOW PROTECTION:
                    - Top-level directory shows ALL items
                    - Nested directories are limited to 100 items maximum per directory
                    - When a nested directory has more than 100 items, you'll see a warning like:
                      [WARNING] node_modules: 500 items hidden (showing first 100 of 600 total)
                    - This prevents overwhelming the context with large directories like node_modules
                    
                    Results show full relative paths from the root directory being listed.
                    Example output with depth=2:
                    [DIR] src
                    [FILE] src/index.ts
                    [DIR] src/tools
                    [FILE] src/tools/filesystem.ts
                    
                    If a directory cannot be accessed, it will show [DENIED] instead.
                    If a path does not exist, it will show [NOT_FOUND] instead.
                    Only works within allowed directories.
                    
                    Absolute paths are the most reliable because they do not depend on the current working directory. Paths are automatically normalized regardless of slash direction. Relative paths depend on the current working directory, and tilde paths (~/...) may not resolve in every context. Absolute paths are generally the most reliable.
                    This command can be referenced as "DC: ..." or "use Desktop Commander to ..." in your instructions.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
depthNo
originNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv0.2.43
    • addedInput schema / properties / origin
      Added value: +{
      +  "enum": [
      +    "ui",
      +    "llm"
      +  ],
      +  "type": "string"
      +}
  2. Changed1 schema field changedv0.2.17
    • addedInput schema / properties / depth
      Added value: +{
      +  "default": 2,
      +  "type": "number"
      +}
  3. First observedv1.0.0

TDQS

A4.4/5.0
Behavior5/5

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

Annotations already cover the safety profile (readOnlyHint=true, destructiveHint=false, openWorldHint=false), and the description goes well beyond them: it discloses context-overflow protection with the 100-item nested cap, the [WARNING]/[DENIED]/[NOT_FOUND] markers, depth-controlled recursion, and path normalization behavior. This is exactly the extra runtime context an agent needs.

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

Conciseness4/5

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

Front-loads purpose, then behavior, examples, and constraints in a scannable order. It is somewhat long, and the closing paragraph repeats the 'absolute paths are most reliable' point twice and appends a promotional 'DC: ...' reference line that does not earn its place, but the bulk of the text is substantive.

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

Completeness5/5

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

There is no output schema, so the description must explain the return format, and it does so thoroughly with a worked depth=2 example plus status markers. Combined with depth and path semantics, an agent has everything required to call it correctly within allowed directories.

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?

With schema coverage at 0%, the description carries the burden and mostly succeeds: it fully explains 'depth' (default 2, with concrete 1/2/3+ semantics) and 'path' (absolute vs relative, tilde resolution, slash normalization). The 'origin' enum parameter is left unexplained, which is the one remaining gap.

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?

States a specific verb and resource ('Get a detailed listing of all files and directories in a specified path') and clarifies it operates 'without starting a shell command,' which distinguishes it from process/shell siblings. An agent can immediately tell this apart from read_file, get_file_info, or the search tools.

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

Usage Guidelines3/5

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

Usage is implied by the purpose and by the constraint 'Only works within allowed directories,' and the 'without starting a shell command' line hints at an alternative approach. However, it never explicitly states when to choose this over sibling discovery tools like start_search or read_multiple_files, nor does it give when-not guidance.

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