Skip to main content
Glama

List Directory

ls
Read-onlyIdempotent

List files and folders in a directory with details: name, path, type, size, modified date. Filter by glob patterns, include hidden or ignored entries, sort by multiple criteria, and paginate through large sets.

Instructions

List immediate directory contents (non-recursive): name, path, type, size, modified date. Omit path for workspace root. includeIgnored=true for node_modules etc. For recursive search, use find.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathNoBase directory (default: root). Absolute path required if multiple roots.
includeHiddenNoInclude hidden items (starting with .)
includeIgnoredNoInclude ignored items (node_modules, .git, etc).
maxDepthNoMax recursion depth when pattern is provided
maxEntriesNoMaximum entries to return before truncation. Default: 20000
sortByNoSort field (name, size, modified, type)name
patternNoOptional glob pattern filter (e.g. "**/*.ts")
includeSymlinkTargetsNoResolve and include symlink targets in results
cursorNoPagination cursor from a previous response

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
okYes
pathNo
entriesNo
totalEntriesNo
truncatedNo
totalFilesNo
totalDirectoriesNo
stoppedReasonNomaxEntries: entry limit hit; aborted: operation was cancelled
skippedInaccessibleNo
nextCursorNoCursor for the next page; absent on the final page
Behavior4/5

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

Annotations already mark the tool as read-only, non-destructive, and idempotent. The description adds that the listing is non-recursive and shows the fields returned, providing useful behavioral context beyond annotations.

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 concise sentences, front-loaded with the core purpose, and zero wasted words.

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?

Given the output schema exists and parameter schemas are complete, the description sufficiently covers the tool's behavior. Could mention pagination or truncation, but not essential for a basic list operation.

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% (all parameters have descriptions). The description mentions 'includeIgnored' usage, but adds little value beyond the schema. Baseline 3 is appropriate when schema fully documents parameters.

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?

The description clearly states the tool lists immediate directory contents non-recursively, specifies the returned fields (name, path, type, size, modified date), and distinguishes it from the sibling 'find' tool for recursive search.

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?

Explicit guidance on when to use this tool vs alternatives: 'For recursive search, use find.' Also provides usage tips like 'Omit path for workspace root' and 'includeIgnored=true for node_modules etc.'

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

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/j0hanz/filesystem-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server