Skip to main content
Glama

List directories

list_directories
Read-only

Enumerate directories under a specified absolute path and sort them by name, size, or modified time, with optional result limits. Use it to inspect folder structure on local or remote Linux hosts.

Instructions

List directories under a specified path with various sorting options.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
hostYesSystem to run on: 'localhost' for the system the MCP server runs on, or a remote host to connect to via SSH
pathYesAbsolute path to the directory to analyze
sortNoSort direction - 'ascending' or 'descending' (default: 'ascending')ascending
top_nNoOptional limit on number of directories to return (1-1000)
order_byNoSort order - 'size', 'name', or 'modified' (default: 'name')name

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
nodesYes
totalNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed16 schema fields changedv1.7.0
    • removedInput schema / properties / host / anyOf
      Removed value: -[
      -  {
      -    "type": "string"
      -  },
      -  {
      -    "type": "null"
      -  }
      -]
    • removedInput schema / properties / host / default
      Removed value: -null
    • changedInput schema / properties / host / description
      Previous value: -"Remote host to connect to via SSH"New value: +"System to run on: 'localhost' for the system the MCP server runs on, or a remote host to connect to via SSH"
    • addedInput schema / properties / host / examples
      Added value: +[
      +  "localhost",
      +  "web1.example.com"
      +]
    • addedInput schema / properties / host / type
      Added value: +"string"
    • changedInput schema / required
      Previous value: -[
      -  "path"
      -]New value: +[
      +  "path",
      +  "host"
      +]
    • removedOutput schema / properties / nodes / items / properties / human_modified
      Removed value: -{
      -  "default": "1970-01-01T00:00:00",
      -  "format": "date-time",
      -  "type": "string"
      -}
    • removedOutput schema / properties / nodes / items / properties / human_size
      Removed value: -{
      -  "default": "",
      -  "type": "string"
      -}
    • removedOutput schema / properties / nodes / items / properties / modified / default
      Removed value: -0
    • addedOutput schema / properties / nodes / items / properties / modified / description
      Added value: +"Modification time"
    • addedOutput schema / properties / nodes / items / properties / modified / format
      Added value: +"date-time"
    • changedOutput schema / properties / nodes / items / properties / modified / type
      Previous value: -"number"New value: +"string"
    • addedOutput schema / properties / nodes / items / properties / size / anyOf
      Added value: +[
      +  {
      +    "type": "integer"
      +  },
      +  {
      +    "type": "null"
      +  }
      +]
    • changedOutput schema / properties / nodes / items / properties / size / default
      Previous value: -0New value: +null
    • addedOutput schema / properties / nodes / items / properties / size / description
      Added value: +"Size in bytes, included only when ordering by size"
    • removedOutput schema / properties / nodes / items / properties / size / type
      Removed value: -"integer"
  2. Changed13 schema fields changedv1.6.0
    • removedInput schema / $defs
      Removed value: -{
      -  "OrderBy": {
      -    "enum": [
      -      "size",
      -      "name",
      -      "modified"
      -    ],
      -    "type": "string"
      -  },
      -  "SortBy": {
      -    "enum": [
      -      "ascending",
      -      "descending"
      -    ],
      -    "type": "string"
      -  }
      -}
    • addedInput schema / additionalProperties
      Added value: +false
    • removedInput schema / properties / order_by / $ref
      Removed value: -"#/$defs/OrderBy"
    • addedInput schema / properties / order_by / enum
      Added value: +[
      +  "size",
      +  "name",
      +  "modified"
      +]
    • addedInput schema / properties / order_by / type
      Added value: +"string"
    • removedInput schema / properties / sort / $ref
      Removed value: -"#/$defs/SortBy"
    • addedInput schema / properties / sort / enum
      Added value: +[
      +  "ascending",
      +  "descending"
      +]
    • addedInput schema / properties / sort / type
      Added value: +"string"
    • removedOutput schema / $defs
      Removed value: -{
      -  "NodeEntry": {
      -    "description": "A node entry model that is used by both directories and files listing.",
      -    "properties": {
      -      "human_modified": {
      -        "default": "1970-01-01T00:00:00",
      -        "format": "date-time",
      -        "type": "string"
      -      },
      -      "human_size": {
      -        "default": "",
      -        "type": "string"
      -      },
      -      "modified": {
      -        "default": 0,
      -        "type": "number"
      -      },
      -      "name": {
      -        "default": "",
      -        "type": "string"
      -      },
      -      "size": {
      -        "default": 0,
      -        "type": "integer"
      -      }
      -    },
      -    "type": "object"
      -  }
      -}
    • removedOutput schema / properties / nodes / items / $ref
      Removed value: -"#/$defs/NodeEntry"
    • addedOutput schema / properties / nodes / items / description
      Added value: +"A node entry model that is used by both directories and files listing."
    • addedOutput schema / properties / nodes / items / properties
      Added value: +{
      +  "human_modified": {
      +    "default": "1970-01-01T00:00:00",
      +    "format": "date-time",
      +    "type": "string"
      +  },
      +  "human_size": {
      +    "default": "",
      +    "type": "string"
      +  },
      +  "modified": {
      +    "default": 0,
      +    "type": "number"
      +  },
      +  "name": {
      +    "default": "",
      +    "type": "string"
      +  },
      +  "size": {
      +    "default": 0,
      +    "type": "integer"
      +  }
      +}
    • addedOutput schema / properties / nodes / items / type
      Added value: +"object"
  3. First observedv0.1.0

TDQS

C2.9/5.0
Behavior2/5

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

The readOnlyHint annotation already covers the safety profile, so the bar is lower, but the description still adds nothing: it does not say whether listing is shallow or recursive, whether hidden directories are included, or that it may execute over SSH on a remote host (the schema hints at this via 'host'). For a filesystem-facing tool this is a meaningful omission.

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?

One sentence, front-loaded with the verb and resource, with no filler. It is efficient, though arguably too terse for a five-parameter tool that can operate against remote hosts.

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

Completeness3/5

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

An output schema exists, so return values need not be described. Still, for a tool that can target localhost or a remote host over SSH, the description leaves behavioral questions (recursion, permissions, remote execution) unanswered; it is minimally adequate rather than complete.

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% with enum values and defaults documented for sort, order_by, and top_n, so the baseline of 3 applies. The description's phrase 'various sorting options' adds no meaning beyond the schema and says nothing about the interaction between order_by and sort.

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?

States a clear verb ('List'), resource ('directories'), and scope ('under a specified path'), which is more than a tautology of the title. However, it never distinguishes itself from the sibling 'list_files', leaving an agent to guess which one returns directories versus files.

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 guidance on when to choose this tool over 'list_files', 'read_file', or the other listing siblings. 'with various sorting options' describes capability, not usage context, so an agent gets no routing help.

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