Skip to main content
Glama
eva-wanxin-git

Windows Automation MCP Server

run_powershell

Execute PowerShell commands and scripts to automate Windows system tasks through the Windows Automation MCP Server.

Instructions

执行 PowerShell 命令或脚本

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesPowerShell 命令或脚本
timeoutNo超时时间(毫秒,可选)

Implementation Reference

  • The core handler function implementing the execution of PowerShell commands with error handling, timeout support, and structured response.
    async runPowerShell(command, timeout = 30000) { try { const { stdout, stderr } = await execAsync( `powershell -Command "${command.replace(/"/g, '\\"')}"`, { shell: 'powershell.exe', timeout, maxBuffer: 1024 * 1024 * 10, // 10MB } ); return { success: true, output: stdout.trim(), error: stderr.trim(), command }; } catch (error) { return { success: false, error: error.message, command }; } }
  • Input schema defining required 'command' parameter and optional 'timeout' for the run_powershell tool.
    inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'PowerShell 命令或脚本' }, timeout: { type: 'number', description: '超时时间(毫秒,可选)' }, }, required: ['command'], },
  • Tool definition object registering the 'run_powershell' tool with name, description, and schema in getToolDefinitions().
    { name: 'run_powershell', description: '执行 PowerShell 命令或脚本', inputSchema: { type: 'object', properties: { command: { type: 'string', description: 'PowerShell 命令或脚本' }, timeout: { type: 'number', description: '超时时间(毫秒,可选)' }, }, required: ['command'], }, },
  • Registration and dispatch logic in executeTool switch statement, mapping tool name to handler.
    case 'run_powershell': return await this.runPowerShell(args.command, args.timeout);
  • Helper list used in canHandle() to check if the tool can be handled.
    const tools = ['run_powershell', 'run_cmd', 'get_system_info', 'get_disk_info', 'get_network_info'];

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