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);

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