Skip to main content
Glama
eva-wanxin-git

Windows Automation MCP Server

delete_file

Remove files or directories from the Windows system to manage storage and organize data efficiently.

Instructions

删除文件或目录

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYes文件或目录路径

Implementation Reference

  • The handler function that executes the delete_file tool: determines if the path is a file or directory and deletes it using fs.unlink or fs.rm with error handling.
    async deleteFile(filePath) {
      try {
        const stats = await fs.stat(filePath);
        if (stats.isDirectory()) {
          await fs.rm(filePath, { recursive: true, force: true });
        } else {
          await fs.unlink(filePath);
        }
        return { success: true, path: filePath, message: '删除成功' };
      } catch (error) {
        return { success: false, error: error.message };
      }
    }
  • Schema definition for the delete_file tool, specifying the input as an object with required 'path' string.
    {
      name: 'delete_file',
      description: '删除文件或目录',
      inputSchema: {
        type: 'object',
        properties: {
          path: { type: 'string', description: '文件或目录路径' },
        },
        required: ['path'],
      },
    },
  • Registration of delete_file handler in the executeTool method's switch statement.
    case 'delete_file':
      return await this.deleteFile(args.path);
  • Includes 'delete_file' in the array of supported tool names checked by canHandle.
    'delete_file', 'copy_file', 'move_file', 'search_files'];

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