Skip to main content
Glama
eva-wanxin-git

Windows Automation MCP Server

list_directory

Retrieve and display the contents of a specified directory path to view files and folders within Windows systems.

Instructions

列出目录内容

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes目录路径

Implementation Reference

  • The handler function that implements the list_directory tool logic. It reads the directory using fs.readdir with file types, maps files to objects with name, type (directory/file), and full path, and returns success with items or error.
    async listDirectory(dirPath) {
      try {
        const files = await fs.readdir(dirPath, { withFileTypes: true });
        const items = files.map(file => ({
          name: file.name,
          type: file.isDirectory() ? 'directory' : 'file',
          path: path.join(dirPath, file.name),
        }));
        return { success: true, items, path: dirPath };
      } catch (error) {
        return { success: false, error: error.message };
      }
    }
  • The schema definition for the list_directory tool, including name, description, and inputSchema requiring a 'path' string.
    {
      name: 'list_directory',
      description: '列出目录内容',
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: '目录路径' },
        },
        required: ['path'],
      },
    },
  • Registration/dispatch in the executeTool method switch statement, which calls the listDirectory handler for the 'list_directory' tool.
    case 'list_directory':
      return await this.listDirectory(args.path);
  • Tool name listed in the canHandle method's tools array for checking if the class can handle 'list_directory'.
    const tools = ['read_file', 'write_file', 'list_directory', 'create_directory', 
                   'delete_file', 'copy_file', 'move_file', 'search_files'];
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It only states the action ('list directory contents') without detailing permissions needed, error handling (e.g., for invalid paths), output format, or any side effects. This is inadequate for a tool with no annotation coverage.

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 phrase ('列出目录内容') that directly conveys the tool's purpose without unnecessary words. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 lack of annotations and output schema, the description is incomplete. It doesn't explain what the tool returns (e.g., file list format, error responses) or behavioral aspects like read-only nature, which is critical for an agent to use it correctly in this 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 documented as '目录路径' (directory path). The description doesn't add any meaning beyond this, such as path format examples or constraints, so it meets the baseline for high schema coverage without compensating value.

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 '列出目录内容' (list directory contents) clearly states the verb ('list') and resource ('directory contents'), making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'search_files' or 'list_processes', which also list resources, so it doesn't reach the highest score.

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 to choose 'list_directory' over 'search_files' for finding files or 'list_processes' for listing processes, nor does it specify prerequisites or exclusions, leaving usage context unclear.

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/eva-wanxin-git/windows-automation-mcp'

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