Skip to main content
Glama
Cytrogen

Local Project Sync

by Cytrogen

list_project_files

Recursively list all files within configured sync directories, enabling efficient access and analysis of local project structures for AI applications.

Instructions

递归列出所有已配置同步目录中的文件

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • src/index.ts:253-267 (registration)
    Registration of the 'list_project_files' tool using server.tool(). Includes tool name, Chinese description, empty input schema ({}), and inline async handler that iterates over pathRegistry, calls getFilesRecursive for each path, formats file lists with prefixes, and returns as text content.
    server.tool(
      "list_project_files",
      "递归列出所有已配置同步目录中的文件",
      {},
      async () => {
        let allFilesText = "项目文件列表:\n---\n";
        for (const [prefix, absolutePath] of pathRegistry.entries()) {
          const files = await getFilesRecursive(absolutePath);
          if (files.length > 0) {
            allFilesText += files.map(file => `${prefix}/${file}`).join('\n') + '\n';
          }
        }
        return { content: [{ type: "text", text: allFilesText }] };
      }
    );
  • The inline handler function for list_project_files. Loops through registered project paths (pathRegistry), recursively gets files using getFilesRecursive, prefixes them, and returns a formatted text list of all project files.
    async () => {
      let allFilesText = "项目文件列表:\n---\n";
      for (const [prefix, absolutePath] of pathRegistry.entries()) {
        const files = await getFilesRecursive(absolutePath);
        if (files.length > 0) {
          allFilesText += files.map(file => `${prefix}/${file}`).join('\n') + '\n';
        }
      }
      return { content: [{ type: "text", text: allFilesText }] };
    }
  • Helper function getFilesRecursive: Recursively traverses directory, skips ignored files/directories (IGNORED_PATTERNS), collects relative paths of all files (normalized to forward slashes), used by the tool handler and other tools.
    async function getFilesRecursive(directory: string): Promise<string[]> {
      let files: string[] = [];
      try {
        const dirents = await fs.readdir(directory, { withFileTypes: true });
        for (const dirent of dirents) {
          if (IGNORED_PATTERNS.has(dirent.name)) continue;
          const fullPath = path.join(directory, dirent.name);
          const relativePath = path.relative(directory, fullPath);
          if (dirent.isDirectory()) {
            const subFiles = await getFilesRecursive(fullPath);
            files.push(...subFiles.map(sf => path.join(relativePath, sf).replace(/\\/g, '/')));
          } else {
            files.push(relativePath.replace(/\\/g, '/'));
          }
        }
      } catch (error) {
        console.error(`Error reading directory ${directory}:`, error);
      }
      return files;
    }
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 states it's a listing operation (implies read-only) and mentions recursion, but doesn't address important aspects like: what format the output takes (list of paths? metadata?), whether there are rate limits, authentication requirements, how many directories are scanned, or what happens with permission errors. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

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 Chinese sentence that conveys the core functionality without any wasted words. It's appropriately sized for a simple listing tool and front-loads the essential information (recursive listing of files in sync directories). Every word earns its place.

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?

Given the tool has no annotations, no output schema, and the description is brief, there are significant completeness gaps. While the purpose is clear, the description doesn't explain what the output looks like (critical for a listing tool), doesn't mention behavioral constraints, and provides no usage context. For a tool that presumably returns file listings, the lack of output information is a notable deficiency.

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

Parameters4/5

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

The input schema has 0 parameters with 100% coverage, so the schema fully documents the absence of parameters. The description doesn't need to compensate for any parameter gaps. It appropriately doesn't mention parameters since none exist, which is correct for this schema configuration.

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 ('递归列出' - recursively list) and the resource ('所有已配置同步目录中的文件' - all files in configured sync directories). It specifies the scope (recursive, all files in sync directories) which helps distinguish it from sibling tools like 'read_file_content' or 'search_code_content'. However, it doesn't explicitly differentiate from 'analyze_project_structure' which might also involve file listing.

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. It doesn't mention when this tool is appropriate versus using 'search_code_content' for filtered searches, 'read_multiple_files' for reading specific files, or 'analyze_project_structure' for structural analysis. There are no prerequisites, exclusions, or comparative context provided.

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

Related 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/Cytrogen/local-project-sync'

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