Skip to main content
Glama

Windows Automation MCP Server

write_file

Create or update files on Windows systems by specifying file path and content for automated file management tasks.

Instructions

写入文件内容

Input Schema

NameRequiredDescriptionDefault
pathYes文件路径
contentYes文件内容

Input Schema (JSON Schema)

{ "properties": { "content": { "description": "文件内容", "type": "string" }, "path": { "description": "文件路径", "type": "string" } }, "required": [ "path", "content" ], "type": "object" }

Implementation Reference

  • The core handler function for the write_file tool, which writes the provided content to the specified file path using fs.writeFile and returns success/error status.
    async writeFile(filePath, content) { try { await fs.writeFile(filePath, content, 'utf-8'); return { success: true, path: filePath, message: '文件写入成功' }; } catch (error) { return { success: false, error: error.message }; } }
  • Schema definition for the write_file tool, including input parameters 'path' and 'content' with their types and descriptions.
    { name: 'write_file', description: '写入文件内容', inputSchema: { type: 'object', properties: { path: { type: 'string', description: '文件路径' }, content: { type: 'string', description: '文件内容' }, }, required: ['path', 'content'], }, },
  • Registration and dispatch logic in the executeTool method's switch statement, which routes 'write_file' calls to the writeFile handler.
    case 'write_file': return await this.writeFile(args.path, args.content);
  • Tool registration check in canHandle method, listing 'write_file' among supported tools.
    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