Skip to main content
Glama
SobieskiCodes

MCP-Claude Code Bridge

list_files

List all files in a project directory to view the structure and contents of your codebase. Specify the project path to retrieve the file listing.

Instructions

List files in a project directory

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_pathYesPath to the project directory

Implementation Reference

  • The main implementation of listFiles method that reads a directory and returns a formatted list of files with icons distinguishing directories from files
    async listFiles(projectPath) {
      const fullPath = path.join(this.workingDir, projectPath);
      try {
        const files = await fs.readdir(fullPath, { withFileTypes: true });
        const fileList = files.map(file => `${file.isDirectory() ? '📁' : '📄'} ${file.name}`).join('\n');
        
        return {
          content: [
            {
              type: "text",
              text: `Files in ${projectPath}:\n\n${fileList}`
            }
          ]
        };
      } catch (error) {
        return {
          content: [
            {
              type: "text",
              text: `Error listing files: ${error.message}`
            }
          ]
        };
      }
    }
  • server.js:79-92 (registration)
    Tool schema registration defining the list_files tool name, description, and input parameters (project_path)
    {
      name: "list_files",
      description: "List files in a project directory",
      inputSchema: {
        type: "object",
        properties: {
          project_path: {
            type: "string",
            description: "Path to the project directory"
          }
        },
        required: ["project_path"]
      }
    },
  • server.js:141-142 (registration)
    Handler routing that maps the 'list_files' tool name to the listFiles method execution
    case 'list_files':
      return await this.listFiles(args.project_path);
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. While 'List files' implies a read-only operation, it doesn't specify whether this returns metadata only, includes hidden files, supports pagination, or has permission requirements. The description lacks critical behavioral context for a file system tool.

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 a single, efficient sentence with zero wasted words. It's appropriately sized for a simple tool and front-loads the essential information without unnecessary elaboration.

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 file listing tool with no annotations and no output schema, the description is insufficient. It doesn't explain what information is returned (file names, metadata, structure), doesn't mention recursion options or filtering capabilities, and provides no context about error conditions or limitations.

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 the single 'project_path' parameter. The description doesn't add any additional semantic context about the parameter beyond what's in the schema, such as path format expectations or directory existence requirements.

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 action ('List files') and the target ('in a project directory'), providing a specific verb+resource combination. However, it doesn't differentiate from sibling tools like 'read_file' or 'create_project', which would require more specificity about scope or output format.

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 'read_file' (for file contents) or 'claude_code_task' (which might involve file operations). There's no mention of prerequisites, limitations, or appropriate contexts for choosing this tool.

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/SobieskiCodes/claude-desktop-mcp-to-claude-agent'

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