Skip to main content
Glama

Windows Automation MCP Server

delete_file

Remove files or directories from Windows systems to manage disk space and maintain organized file structures.

Instructions

删除文件或目录

Input Schema

NameRequiredDescriptionDefault
pathYes文件或目录路径

Input Schema (JSON Schema)

{ "properties": { "path": { "description": "文件或目录路径", "type": "string" } }, "required": [ "path" ], "type": "object" }

Implementation Reference

  • The core handler function that deletes a file or directory. It checks if the path is a directory using fs.stat and uses fs.rm (recursive) for directories or fs.unlink for files.
    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 }; } }
  • Tool schema definition including name, description, and input schema requiring a 'path' parameter.
    { name: 'delete_file', description: '删除文件或目录', inputSchema: { type: 'object', properties: { path: { type: 'string', description: '文件或目录路径' }, }, required: ['path'], }, },
  • Registration of the delete_file tool within the executeTool switch statement, dispatching to the deleteFile handler.
    case 'delete_file': return await this.deleteFile(args.path);
  • Includes 'delete_file' in the list of handled tools in the canHandle method.
    const tools = ['read_file', 'write_file', 'list_directory', 'create_directory', 'delete_file', 'copy_file', 'move_file', 'search_files']; return tools.includes(toolName);

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