Skip to main content
Glama

Directory Tree

directory_tree
Read-only

Generates a recursive JSON tree view of files and directories within allowed paths, with names, types, children, and optional exclude patterns.

Instructions

Get a recursive tree view of files and directories as a JSON structure. Each entry includes 'name', 'type' (file/directory), and 'children' for directories. Files have no children array, while directories always have a children array (which may be empty). The output is formatted with 2-space indentation for readability. Only works within allowed directories.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes
excludePatternsNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
contentYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. First observed

TDQS

B3.2/5.0
Behavior3/5

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

Annotations already declare readOnlyHint=true and openWorldHint=false, so the safety profile is covered without help from the description. The description does add the practical constraint that the tool is scoped to allowed directories, which is useful behavioral context, but it says nothing about recursion depth limits, handling of unreadable subdirectories, or volume of output for deep trees.

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?

Four tight sentences, front-loaded with the core purpose, and the per-entry structure is spelled out compactly. It is slightly padded by return-format detail (indentation, children arrays) that duplicates the existing output schema.

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?

Because an output schema exists, the description's lengthy explanation of return structure is redundant rather than harmful. Meanwhile the real gap — no explanation of the excludePatterns filter for a recursive walk over potentially huge trees — is unaddressed, so the definition is only partially complete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% for two parameters, so the description carries the full burden and fails it: neither 'path' nor 'excludePatterns' is mentioned anywhere. The excludePatterns parameter in particular is completely undocumented, leaving the agent to guess its syntax, matching semantics, and interaction with the recursive walk.

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 ('recursive tree view of files and directories') and the recursion itself implicitly separates it from flat siblings like list_directory. It never names an alternative, so the differentiation is left for the agent to infer.

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?

There is no explicit when-to-use or when-not-to-use guidance, nor any named alternative among the eight sibling listing/reading tools. The only usage constraint is 'Only works within allowed directories', which implies a prerequisite (discover directories via list_allowed_directories) but frames it as a limitation rather than routing guidance.

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