Skip to main content
Glama
danielklecha

mcp-server-for-powershell

run_powershell

Execute PowerShell commands using a structured JSON definition. Supports single commands, pipelines, .NET methods, named parameters, and multi-command sequences.

Instructions

Executes PowerShell commands based on a structured JSON definition.

This tool allows you to run PowerShell commands safely strings.
It expects a JSON string that defines the command(s), parameters, pipelines, and sequences.

Args:
    json: A JSON string defining the command structure.
          Structure examples:
          1. Single Command:
             [{"command": "Get-Item", "parameters": ["."]}]

          2. .NET Static Method:
             [{"command": "[System.Math]::Sqrt", "parameters": [16]}]
             # Generates: [System.Math]::Sqrt(16)

          3. Command with Named Parameters:
             [{"command": "Get-Item", "parameters": {"-Path": "."}}]

          4. Pipeline:
             [{"command": "Get-Process", "then": {"command": "Select-Object", "parameters": ["Name"]}}]

          5. Sequence (Multiple commands):
             [{"command": "mkdir", "parameters": ["test"]}, {"command": "cd", "parameters": ["test"]}]

Returns:
    The standard output of the executed PowerShell command(s), or an error message if execution fails.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jsonYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior2/5

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

No annotations are provided, so the description must disclose behavioral traits alone. It only mentions 'Executes PowerShell commands... safely strings' (vague) and returns standard output or error. It does not disclose security implications, required permissions, sandboxing, or limitations on commands. This is insufficient for a command execution tool that could be destructive.

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

Conciseness4/5

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

The description is relatively long due to detailed examples, which are justified given the complexity of the input format. It is well-structured with bullet points and clear sections (Args, Returns). The main purpose is front-loaded. Could be slightly trimmed, but overall efficient for the required detail.

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

Completeness3/5

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

Given the tool's potential to execute arbitrary code and the presence of an output schema (not shown), the description is moderately complete. It covers input format well but lacks details on execution environment, error handling, performance considerations, or return value structure beyond 'standard output'. This leaves gaps for an agent deciding to use the tool.

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

Parameters5/5

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

The schema has 0% description coverage for the single parameter 'json', but the description compensates richly with seven examples of valid JSON structures, covering single commands, pipelines, and sequences. This adds significant meaning beyond the schema's raw 'string' type, making it very helpful for the agent.

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

Purpose5/5

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

The description clearly states the tool's purpose: 'Executes PowerShell commands based on a structured JSON definition.' The verb 'executes' and the resource 'PowerShell commands' are specific, and the JSON-based input distinguishes it from general command execution. Despite an awkward phrase ('safely strings'), the purpose is unambiguous.

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

Usage Guidelines4/5

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

While there are no sibling tools, the description provides extensive guidance on how to format the input, including multiple examples of single commands, .NET methods, named parameters, pipelines, and sequences. However, it does not explicitly state when to use this tool or mention any prerequisites (e.g., PowerShell availability). The implied context is sufficient for an AI agent to understand usage.

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/danielklecha/mcp-server-for-powershell'

If you have feedback or need assistance with the MCP directory API, please join our Discord server