Skip to main content
Glama

List Directory

list_directory
Read-onlyIdempotent

Lists files and directories directly inside an allowed path, marking each entry as [FILE] or [DIR] so you can inspect directory contents.

Instructions

List the files and directories directly inside a path, each marked [FILE] or [DIR]. Use it to see what a directory contains; when you also need each entry's size or want entries sorted by size, use list_directory_with_sizes instead, and for a recursive view use directory_tree. Returns one line per entry. Only works within allowed 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": {
      "path": "<path>"
    },
    "name": "list_directory"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathYesThe directory to list. Absolute, or relative to an allowed directory; it must resolve inside the allowed directories.

Output Schema

NameRequiredDescriptionDefault
contentYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv0.3.0

TDQS

A4.4/5.0
Behavior4/5

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

Annotations already declare readOnly, idempotent, non-destructive, and closed-world behavior, so the description's job is to add context beyond that. It does add the output shape ("one line per entry", entries tagged [FILE]/[DIR]) and the access constraint ("Only works within allowed directories"). It stops short of disclosing other behavioral traits such as ordering, symlink handling, or what error/empty-directory responses look like, so it falls just short of a 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?

Three sentences, front-loaded with the verb and output format, then routing to alternatives. The closing sentence about allowed directories partially repeats the schema's path description, which is minor redundancy but still useful as a global constraint.

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?

For a simple one-parameter read tool with an output schema present, the definition covers purpose, output shape, access limits, and sibling routing. Nothing an agent needs in order to call it correctly is missing.

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?

With a single parameter and 100% schema description coverage, the schema already explains that path is absolute or relative to an allowed directory and must resolve inside them, so the baseline is 3. The description's phrasing "directly inside a path" reinforces non-recursive depth semantics but adds no new format or constraint detail beyond the schema text.

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 ("List the files and directories directly inside a path") plus the output shape ("each marked [FILE] or [DIR]"), and explicitly distinguishes itself from two named siblings. An agent can identify which list tool to call without opening any schema.

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

Usage Guidelines5/5

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

Gives an explicit when-to-use statement ("Use it to see what a directory contains") and names both alternatives with the condition that selects each: list_directory_with_sizes for sizes/size-sorting, directory_tree for recursion. No inference is required from the sibling list.

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