Skip to main content
Glama

List Directory

list_directory
Read-onlyIdempotent

Lists folder contents with optional recursion and returns compact lines showing folders and file sizes. Use it to inspect remote directory structure and filter entries before reading files.

Instructions

List a folder (optionally recursive). Returns compact lines: 'd name/' for folders, 'f name size' for files.

Tool call template

This tool declares no required parameters. Add optional parameters from the input schema as needed.

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

Input Schema

NameRequiredDescriptionDefault
pathNoFolder to list. Empty or '.' = server root..
depthNo1 = only this folder; 2+ = recurse that many levels (max 10).
patternNoOptional name filter glob, e.g. '*.py'. Folders are always shown when recursing.
skip_heavyNoWhen recursing, don't descend into node_modules, .git, venvs, build dirs.
max_entriesNoStop after this many entries.
show_hiddenNoInclude dotfiles.

Output Schema

NameRequiredDescriptionDefault

No arguments

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv1.0.0

TDQS

B3.4/5.0
Behavior3/5

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

Annotations already declare readOnlyHint, idempotentHint, destructiveHint=false and openWorldHint=false, so the safety profile is fully covered by structured data. The description adds the entry-line format, which is genuinely useful context beyond the annotations, but says nothing about truncation behavior when max_entries is hit, error handling for missing paths, or sort order.

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?

Two short sentences with the core action front-loaded and the output format following immediately; every clause carries information and nothing is padded.

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?

With full schema coverage, rich annotations and an output schema present, the definition does not need to explain return values and correctly stays brief. The remaining gap is minor: no mention of what happens when max_entries truncates results or how missing paths are reported.

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 six parameters including path, depth, pattern, skip_heavy, max_entries and show_hidden are already documented in the schema. The description's only added semantic is 'optionally recursive', which maps directly to the depth parameter and adds little. Baseline 3 applies when the schema does the heavy lifting.

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 a folder') plus the scope modifier '(optionally recursive)', which is enough to distinguish it from mutation siblings like create_directory or delete_path. It does not, however, contrast itself with find_files or search_text, which overlap on the same resource.

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?

There is no explicit when-to-use or when-not-to-use guidance and no alternative tool is named, even though find_files is a plausible competitor for the same directory tree. The only usage signal is the parenthetical 'optionally recursive', which merely restates the depth parameter.

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