copy_file
Copy files between locations on Windows systems to automate file management tasks within the Windows Automation MCP Server environment.
Instructions
复制文件
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | 源文件路径 | |
| destination | Yes | 目标文件路径 |
Implementation Reference
- src/tools/filesystem.js:193-200 (handler)The handler function that performs the file copy operation using fs.copyFile from Node.js fs/promises module. It handles errors and returns a structured success or error response.async copyFile(source, destination) { try { await fs.copyFile(source, destination); return { success: true, source, destination, message: '复制成功' }; } catch (error) { return { success: false, error: error.message }; } }
- src/tools/filesystem.js:70-81 (schema)The tool definition including name, description, and input schema for validating arguments (source and destination file paths).{ name: 'copy_file', description: '复制文件', inputSchema: { type: 'object', properties: { source: { type: 'string', description: '源文件路径' }, destination: { type: 'string', description: '目标文件路径' }, }, required: ['source', 'destination'], }, },
- src/tools/filesystem.js:127-128 (registration)Registration in the executeTool switch statement, dispatching copy_file calls to the copyFile handler method.case 'copy_file': return await this.copyFile(args.source, args.destination);