Skip to main content
Glama
theburgerllc

AI Development Pipeline MCP

by theburgerllc

list_directory_files

Lists files in a workspace directory to help developers navigate project structures and manage code assets within the AI Development Pipeline MCP environment.

Instructions

List files in a workspace directory (restricted to workspace directory)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
dirYes

Implementation Reference

  • Registration of the 'list_directory_files' tool using server.tool(), including schema and inline handler function.
    server.tool(
      'list_directory_files',
      'List files in a workspace directory (restricted to workspace directory)',
      { dir: z.string() },
      async ({ dir }) => {
        try {
          const safePath = validatePath(dir);
          const files = fs.readdirSync(safePath);
          // Filter out sensitive files
          const filteredFiles = files.filter(file =>
            !file.startsWith('.env') &&
            !file.includes('secret') &&
            !file.includes('key') &&
            !file.includes('password')
          );
          return { content: [{ type: 'text', text: JSON.stringify(filteredFiles, null, 2) }] };
        } catch (err: any) {
          return { content: [{ type: 'text', text: `Directory read error: ${err.message}` }] };
        }
      }
    );
  • Handler function that validates the directory path, reads files using fs.readdirSync, filters sensitive files, and returns JSON list.
    async ({ dir }) => {
      try {
        const safePath = validatePath(dir);
        const files = fs.readdirSync(safePath);
        // Filter out sensitive files
        const filteredFiles = files.filter(file =>
          !file.startsWith('.env') &&
          !file.includes('secret') &&
          !file.includes('key') &&
          !file.includes('password')
        );
        return { content: [{ type: 'text', text: JSON.stringify(filteredFiles, null, 2) }] };
      } catch (err: any) {
        return { content: [{ type: 'text', text: `Directory read error: ${err.message}` }] };
      }
    }
  • Input schema defining 'dir' parameter as string using Zod.
    { dir: z.string() },
  • Helper function validatePath used to secure directory path against traversal attacks.
    function validatePath(filePath: string): string {
      const resolvedPath = path.resolve(WORKSPACE_ROOT, filePath);
      if (!resolvedPath.startsWith(WORKSPACE_ROOT)) {
        throw new Error('Path traversal detected - access denied');
      }
      return resolvedPath;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It mentions the workspace restriction but doesn't describe what the tool returns (file names, metadata, structure), whether it's paginated, what errors might occur, or any performance characteristics. This leaves significant gaps in understanding how the tool behaves.

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 extremely concise - a single sentence that states the core purpose. There's no wasted verbiage or unnecessary elaboration. It's appropriately sized for a simple listing tool.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no annotations, no output schema, and 0% schema description coverage, the description is insufficient. It doesn't explain what the tool returns, how to interpret results, error conditions, or provide enough context for reliable use. The workspace restriction is mentioned but not elaborated.

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?

The schema has 0% description coverage for the single 'dir' parameter. The description doesn't explain what format 'dir' should be (path syntax, relative vs absolute), what constitutes a valid workspace directory, or provide any examples. This leaves the parameter meaning unclear despite the simple schema.

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 clearly states the verb ('List') and resource ('files in a workspace directory'), making the purpose understandable. However, it doesn't distinguish this tool from potential siblings like 'check_file_exists' or 'read_project_file' beyond mentioning the restriction to workspace directories.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'check_file_exists' or 'read_project_file'. It mentions the restriction to workspace directories but doesn't explain why this matters or what happens if you try to list non-workspace files.

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/theburgerllc/ai-development-pipeline-mcp'

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