Skip to main content
Glama

Directory tree

tree
Read-only

Displays directory structure as structured nodes for AI/LLM workflows, with options to filter by glob pattern, limit depth, exclude paths, or show directories only.

Instructions

Show directory structure as a compact tree. Returns structured nodes instead of ASCII art. Use dirsOnly for directory-only view, pattern to filter by glob, maxDepth to control depth.

Input Schema

NameRequiredDescriptionDefault
pathYesRoot directory
excludeNoPipe-separated patterns to exclude (default: node_modules|.git|dist|__pycache__|.venv|.next|.terraform)
patternNoOnly show files matching glob pattern
dirsOnlyNoOnly show directories
maxDepthNoMax depth (default 3)

Output Schema

NameRequiredDescriptionDefault
dirsYes
filesYes
pathsYes
retainedNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observedv5.0.1

TDQS

A3.6/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true, so the safety profile is covered. The description adds a useful behavioral detail — returning structured nodes rather than ASCII art — but with an output schema present that detail is somewhat redundant, and it omits other behavioral context such as the default excluded paths (left to 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.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is three short sentences with zero waste. Purpose is front-loaded, output format follows, and parameter options come last — each sentence earns its place.

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?

For a read-only tree tool with full schema coverage, annotations, and an output schema, the description covers what the tool does, its output form, and key options. The main missing piece is routing guidance versus sibling tools like ls or find_files, but otherwise an agent has enough to call it correctly.

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%, so the schema already documents all five parameters. The description repeats semantics for dirsOnly, pattern, and maxDepth without adding syntax or constraints beyond the schema, and it does not mention the exclude parameter. Baseline 3 is appropriate when the schema does the heavy lifting.

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?

The description states a specific verb and resource: 'Show directory structure as a compact tree.' It further clarifies the output form ('structured nodes instead of ASCII art'), which distinguishes it from an ASCII tree or raw listing. However, it does not explicitly differentiate itself from sibling tools like ls, find_files, or glob, so it falls short of a 5.

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

Usage Guidelines3/5

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

The description gives option-level guidance ('Use dirsOnly for directory-only view, pattern to filter by glob, maxDepth to control depth'), but it does not state when to use this tool versus alternatives such as ls, find_files, or glob. Usage is implied by the purpose rather than explicitly guided.

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