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'];
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It states the action ('执行' - execute) but doesn't describe what happens during execution (e.g., runs in a shell, returns output/errors, affects system state), security implications, permission requirements, or error handling. For a tool that executes system commands with potential side effects, this is a significant gap in transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise—a single sentence that directly states the tool's function without any fluff. It is front-loaded with the core action and resource, making it easy to parse. Every word earns its place, and there is no wasted verbiage.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of executing PowerShell commands (which can have system-wide effects) and the lack of annotations and output schema, the description is incomplete. It doesn't cover behavioral aspects like output format, error handling, security risks, or dependencies. For a tool with potential high impact and no structured safety hints, more context is needed to ensure safe and effective use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema description coverage is 100%, with both parameters ('command' and 'timeout') fully described in the schema. The description adds no additional meaning beyond what the schema provides (e.g., no examples of valid commands, timeout defaults, or script formats). With high schema coverage, the baseline score of 3 is appropriate, as the description doesn't enhance parameter understanding.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description '执行 PowerShell 命令或脚本' clearly states the tool's purpose: executing PowerShell commands or scripts. It specifies both the verb ('执行' - execute) and the resource ('PowerShell 命令或脚本' - PowerShell commands or scripts), making the purpose unambiguous. However, it doesn't explicitly differentiate from its sibling 'run_cmd', which likely executes CMD commands instead.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. There is no mention of when to choose PowerShell over CMD (via 'run_cmd') or other execution methods, nor any context about prerequisites, security considerations, or typical use cases. Usage is implied only by the tool's name and description.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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