Skip to main content
Glama

read_directory

List files and folders in a directory to explore the file structure within accessible roots for architectural decision record analysis.

Instructions

List files and folders in a directory. Use this to explore the file structure within accessible roots.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesDirectory path to list (relative to project root or absolute within roots)

Implementation Reference

  • Registers the 'read_directory' tool in the central TOOL_CATALOG with full metadata including input schema (path: string required, recursive: boolean optional). Used for dynamic tool discovery, MCP ListTools responses, and search_tools meta-tool.
    TOOL_CATALOG.set('read_directory', {
      name: 'read_directory',
      shortDescription: 'Read directory contents',
      fullDescription: 'Lists contents of a directory.',
      category: 'file-system',
      complexity: 'simple',
      tokenCost: { min: 100, max: 1000 },
      hasCEMCPDirective: true, // Phase 4.3: Simple tool - directory read
      relatedTools: ['read_file', 'list_directory'],
      keywords: ['directory', 'read', 'list'],
      requiresAI: false,
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: 'Path to directory' },
          recursive: { type: 'boolean', default: false },
        },
        required: ['path'],
      },
    });
  • Defines the input schema and complete metadata for the read_directory tool, including description 'Read directory contents and metadata', category 'file-system', and no AI requirement.
    TOOL_CATALOG.set('read_directory', {
      name: 'read_directory',
      shortDescription: 'Read directory contents',
      fullDescription: 'Lists contents of a directory.',
      category: 'file-system',
      complexity: 'simple',
      tokenCost: { min: 100, max: 1000 },
      hasCEMCPDirective: true, // Phase 4.3: Simple tool - directory read
      relatedTools: ['read_file', 'list_directory'],
      keywords: ['directory', 'read', 'list'],
      requiresAI: false,
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: 'Path to directory' },
          recursive: { type: 'boolean', default: false },
        },
        required: ['path'],
      },
    });
  • Lists 'read_directory' tool in the hardcoded server context generation for LLM awareness, under File System Operations category.
    { name: 'read_directory', description: 'Read directory contents and metadata' },
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It effectively indicates this is a read-only operation ('List') and specifies the scope ('within accessible roots'), which is useful. However, it lacks details on permissions, error handling, output format, or pagination, leaving gaps for a tool that interacts with file systems.

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 front-loaded with the core purpose in the first sentence and uses a second sentence to add context, with no wasted words. It is appropriately sized for a simple tool, making it easy to parse quickly.

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?

Given the tool's low complexity (one parameter, no output schema, no annotations), the description is adequate but has gaps. It covers the basic purpose and usage context but lacks details on behavioral aspects like error cases or output structure, which could be important for effective tool invocation in a file system context.

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?

The input schema has 100% description coverage, with the 'path' parameter well-documented in the schema. The description adds minimal value beyond the schema by implying the tool is for exploration, but does not provide additional syntax, format details, or constraints. This meets the baseline for high schema coverage.

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 specific action ('List files and folders') and target resource ('in a directory'), using precise verbs. It distinguishes from the sibling 'list_directory' by specifying 'within accessible roots' and mentioning exploration of file structure, which provides additional context about scope and intent.

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 provides clear context for when to use the tool ('to explore the file structure within accessible roots'), which helps guide its application. However, it does not explicitly mention when not to use it or name alternatives (like 'list_roots' for root-level exploration or 'read_file' for file content), leaving some ambiguity about sibling tool differentiation.

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/tosin2013/mcp-adr-analysis-server'

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