Skip to main content
Glama

List

list
Read-onlyIdempotent

Display a directory's contents as a name tree, walking up to a chosen depth, so you can see what a folder holds.

Instructions

List a directory inside the roots as a name tree, walking up to maxDepth levels. Use when you need to see what a folder holds. Do not use it to find files by name or glob; use find_files instead, read or search_text for contents, stat for one path. Skips hidden entries, .gitignore matches, and build and tool folders unless includeHidden or includeIgnored is set, naming the ignore-rule folders it hid. At most 20,000 entries are kept. A timeout returns a partial result with stoppedReason. Errors: NOT_DIRECTORY for a file, ACCESS_DENIED outside the roots. Returns tree text, entries[{name, relativePath, type, size?}], totals, unexpandedDirectories, and skippedInaccessible. A cut result adds nextCursor (about 5 min) and resourceUri (about 60 s).

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"
  }
}

Input Schema

NameRequiredDescriptionDefault
pathNoDirectory to list (default: the only root; required with several roots)
cursorNoOpaque pagination cursor. Pass it unchanged for the next page. Pages come from one snapshot taken on the first call. It lasts 5 min past its last page; on refusal, retry without it.
sortByNoOrder within each directory, after directories (size: largest file first; sizes appear only with includeSizes)name
excludeNoGlobs for entries to leave out, with everything under a matching folder. Without / a pattern matches a name at any depth (vendor, *.test.ts); with / it matches the path relative to path.
maxDepthNoLevels to walk; 1 = direct children. Directories at the limit are shown, not expanded.
maxEntriesNoEntries per page; changing it keeps a cursor valid
includeSizesNoShow file sizes and a totals line in the tree (stats every file, slower on big trees)
includeHiddenNoInclude hidden items (starting with .)
includeIgnoredNoInclude .gitignore matches and build and tool folders (node_modules, .git, dist, build, out, tmp, coverage)

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed2 schema fields changedv2.22.0
    • changedInput schema / properties / cursor / description
      Previous value: -"Opaque pagination cursor. Pass it unchanged for the next page. Pages come from one snapshot taken on the first call. It expires after ~60s; if rejected, retry without a cursor."New value: +"Opaque pagination cursor. Pass it unchanged for the next page. Pages come from one snapshot taken on the first call. It lasts 5 min past its last page; on refusal, retry without it."
    • addedInput schema / properties / exclude
      Added value: +{
      +  "description": "Globs for entries to leave out, with everything under a matching folder. Without / a pattern matches a name at any depth (vendor, *.test.ts); with / it matches the path relative to path.",
      +  "items": {
      +    "description": "Relative glob pattern under the search root (e.g. \"**/*.ts\", \"src/**/*.js\").",
      +    "examples": [
      +      "**/*.ts",
      +      "src/**/*.js",
      +      "**/*.{ts,tsx}"
      +    ],
      +    "maxLength": 1000,
      +    "minLength": 1,
      +    "type": "string"
      +  },
      +  "maxItems": 20,
      +  "minItems": 1,
      +  "type": "array"
      +}
  2. Changed7 schema fields changedv2.20.0
    • changedInput schema / properties / cursor / description
      Previous value: -"Opaque pagination cursor; pass unchanged for the next page. Pages slice one snapshot taken on the first call; it expires after ~60s — re-request without a cursor if rejected."New value: +"Opaque pagination cursor. Pass it unchanged for the next page. Pages come from one snapshot taken on the first call. It expires after ~60s; if rejected, retry without a cursor."
    • changedInput schema / properties / includeIgnored / description
      Previous value: -"Include ignored items (node_modules, .git, etc)."New value: +"Include .gitignore matches and build and tool folders (node_modules, .git, dist, build, out, tmp, coverage)"
    • changedInput schema / properties / includeSizes / description
      Previous value: -"Show file sizes in the tree and a totals line of counts and bytes"New value: +"Show file sizes and a totals line in the tree (stats every file, slower on big trees)"
    • changedInput schema / properties / maxDepth / description
      Previous value: -"Max directory depth to traverse (default: 1 = top-level only; increase to recurse deeper)"New value: +"Levels to walk; 1 = direct children. Directories at the limit are shown, not expanded."
    • changedInput schema / properties / maxEntries / description
      Previous value: -"Page size (default: 1000). Continue with nextCursor; an incomplete first page also carries resourceUri for the whole list."New value: +"Entries per page; changing it keeps a cursor valid"
    • changedInput schema / properties / path / description
      Previous value: -"Directory to list (default: the only root)"New value: +"Directory to list (default: the only root; required with several roots)"
    • changedInput schema / properties / sortBy / description
      Previous value: -"Order within each directory: name (default) or size (largest first)"New value: +"Order within each directory, after directories (size: largest file first; sizes appear only with includeSizes)"
  3. Changed1 schema field changedv2.17.0
    • changedInput schema / properties / path / description
      Previous value: -"Directory to list (default: first allowed root)"New value: +"Directory to list (default: the only root)"
  4. Changed2 schema fields changedv2.9.1
    • addedInput schema / properties / includeSizes
      Added value: +{
      +  "default": false,
      +  "description": "Show file sizes in the tree and a totals line of counts and bytes",
      +  "type": "boolean"
      +}
    • addedInput schema / properties / sortBy
      Added value: +{
      +  "default": "name",
      +  "description": "Order within each directory: name (default) or size (largest first)",
      +  "enum": [
      +    "name",
      +    "size"
      +  ],
      +  "type": "string"
      +}
  5. Changed1 schema field changedv2.4.1
    • addedInput schema / $schema
      Added value: +"https://json-schema.org/draft/2020-12/schema"
  6. Changed1 schema field changedv2.1.5
    • changedInput schema / properties / maxEntries / description
      Previous value: -"Page size (default: 1000). Continue with nextCursor; resourceUri is only for hard-cap overflow."New value: +"Page size (default: 1000). Continue with nextCursor; an incomplete first page also carries resourceUri for the whole list."
  7. Addedv2.0.0

TDQS

A4.9/5.0
Behavior5/5

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

Annotations already cover read-only, idempotent, non-destructive, but the description adds behavior an agent could not infer: default skipping of hidden, .gitignore, and build/tool folders with an override flag, a 20,000-entry ceiling, partial results with stoppedReason on timeout, specific error codes (NOT_DIRECTORY, ACCESS_DENIED), and the exact return payload including cursor and resourceUri lifetimes.

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?

Ordering is optimal: purpose, then negative routing, then behavior/defaults, then limits, then errors, then return shape. Sentences are dense with facts and none is filler, even at roughly nine sentences.

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 9-parameter traversal tool with no output schema, the description fully compensates by enumerating the return fields and error conditions. Combined with annotations and a richly documented schema, an agent has everything needed to call it correctly.

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?

Schema coverage is 100%, so the per-parameter descriptions already do heavy lifting; the description still adds cross-parameter meaning by tying includeHidden/includeIgnored to the default skip behavior and noting that ignored-folder names are reported back. The remaining parameters (sortBy, exclude, includeSizes, cursor) are left to the schema, which is acceptable.

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?

"List a directory inside the roots as a name tree, walking up to maxDepth levels" names a specific verb, resource, and scope, and immediately pins down what the output shape is (a name tree) rather than a flat list. It is clearly distinguishable from read, find_files, and stat.

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?

The description states the positive trigger ("use when you need to see what a folder holds") and then explicitly excludes the wrong cases, routing to find_files for name/glob search, read or search_text for contents, and stat for a single path. This is textbook when/when-not/alternative guidance.

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