Skip to main content
Glama

List

list
Read-only

Enumerates a directory's files and subdirectories as a tree, with controls for depth, hidden/ignored entries, sizes, and dates.

Instructions

List a directory's files and subdirectories as a tree of names, like ls or tree, one level deep unless maxDepth is raised. Hidden entries are skipped unless includeHidden is set, and ignored ones (.gitignore matches, node_modules, dist, build, out, tmp) unless includeIgnored is set. includeSizes adds sizes and a total; stat returns dates; find_files searches by name pattern.

Input Schema

NameRequiredDescriptionDefault
pathNoDirectory to list (default: first allowed root)
cursorNoOpaque 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.
sortByNoOrder within each directory: name (default) or size (largest first)name
maxDepthNoMax directory depth to traverse (default: 1 = top-level only; increase to recurse deeper)
maxEntriesNoPage size (default: 1000). Continue with nextCursor; an incomplete first page also carries resourceUri for the whole list.
includeSizesNoShow file sizes in the tree and a totals line of counts and bytes
includeHiddenNoInclude hidden items (starting with .)
includeIgnoredNoInclude ignored items (node_modules, .git, etc).

Schema Changelog

Changes observed during successful MCP inspections.

  1. 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"
      +}
  2. Changed1 schema field changedv2.4.1
    • addedInput schema / $schema
      Added value: +"https://json-schema.org/draft/2020-12/schema"
  3. 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."
  4. Addedv2.0.0

TDQS

A4.3/5.0
Behavior4/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so safety is covered. The description adds useful behavioral context: hidden entries are skipped by default, ignored patterns (.gitignore, node_modules, dist, build, out, tmp) are excluded unless includeIgnored is set, and maxDepth defaults to one level. It doesn't discuss pagination or cursor expiry, but that is in the schema.

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 behavior and default depth, then covers exclusions, then optional features. The final sentence mixes sibling-tool functions ('stat returns dates; find_files searches by name pattern') which is slightly off-tool but still useful for routing; overall it is efficient with little waste.

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 8 optional parameters, 100% schema coverage, no output schema, and clear annotations, the description provides enough context for correct invocation: it explains default depth, exclusions, and size totals. Pagination details live in the schema, so no critical gap remains, though the return format could be slightly more explicit.

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 baseline is 3. The description earns a higher score by clarifying the effect of parameters: 'unless maxDepth is raised', 'unless includeHidden is set', 'unless includeIgnored is set', and 'includeSizes adds sizes and a total'. This adds practical meaning beyond the schema's technical descriptions.

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+resource ('List a directory's files and subdirectories as a tree of names') and explicitly contrasts with sibling tools 'stat' and 'find_files' in the same breath. An agent can distinguish this from other file-listing/search tools without opening schemas.

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

Usage Guidelines4/5

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

The description routes the agent: use this for directory trees, use 'stat' for dates, use 'find_files' for name-pattern search. It does not mention when to prefer 'list_roots' or when-not to use this tool, but the primary alternatives are clearly named.

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