Skip to main content
Glama

list_directory

Read-only

Lists directory contents with entry type, size in bytes, and child counts. Recurses into subdirectories while honoring .gitignore rules and skipping node_modules, pycache, and .git.

Instructions

List the contents of a directory.

Each entry has a type field: 'dir' for directories, 'file' for files.
Use max_depth > 1 to recurse into subdirectories. Automatically ignores
__pycache__, node_modules, and .git, plus nested .gitignore/.ignore
rules. Returns entry type, size in bytes, and child count for directories.

Tool call template

Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.

{
  "id": 1,
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "arguments": {
      "absolute_dir_path": "<absolute_dir_path>"
    },
    "name": "list_directory"
  }
}

Input Schema

NameRequiredDescriptionDefault
max_depthNoHow many levels deep to recurse (default: 1 = direct children only).
max_entriesNoMaximum total entries to return. Defaults to server config (200).
include_hiddenNoInclude entries starting with '.' (default: false).
absolute_dir_pathYesThe absolute path to the directory to list.
respect_gitignoreNoHonor nested .gitignore/.ignore files when filtering (default: server default, true). Set false to include ignored entries.

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv1.0.0
    • addedInput schema / properties / max_depth / minimum
      Added value: +1
    • addedInput schema / properties / respect_gitignore
      Added value: +{
      +  "anyOf": [
      +    {
      +      "type": "boolean"
      +    },
      +    {
      +      "type": "null"
      +    }
      +  ],
      +  "default": null,
      +  "description": "Honor nested .gitignore/.ignore files when filtering (default: server default, true). Set false to include ignored entries.",
      +  "title": "Respect Gitignore"
      +}
  2. First observedv0.3.0

TDQS

A3.5/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and destructiveHint=false, so the description does not need to establish safety. It adds useful behavior beyond annotations by disclosing automatic ignores for __pycache__, node_modules, .git, and nested .gitignore/.ignore rules, plus the returned fields. It omits truncation behavior from max_entries, which keeps it below 5.

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?

The description is front-loaded, with the core action stated first and no filler. It is slightly fragmented and repeats max_depth guidance already present in the schema, but every sentence contributes useful information.

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?

There is no output schema, so the description's return-field details are valuable, and annotations cover the safety profile. For a five-parameter read-only listing tool, it is mostly complete, though it could mention max_entries truncation and hidden-file default behavior.

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

Parameters3/5

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

Schema description coverage is 100%, so all five parameters are already documented. The description reinforces max_depth recursion and ignore behavior, but it does not add parameter meaning beyond what the schema provides for include_hidden, max_entries, or respect_gitignore.

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

Purpose4/5

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

The description states a specific verb and resource: list the contents of a directory. It does not explicitly distinguish this tool from siblings such as search_directory or find_files, so it falls short of a 5.

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

Usage Guidelines2/5

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

The only usage advice is 'Use max_depth > 1 to recurse into subdirectories,' which is parameter guidance rather than when-to-use guidance. It does not explain when to choose list_directory over search_directory, find_files, or get_overview.

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