Skip to main content
Glama
s2005

Windows CLI MCP Server

by s2005

execute_command

Execute shell commands in PowerShell, CMD, Git Bash, Bash, or WSL with security controls, path validation, and configurable output limits for Windows system management.

Instructions

Execute a command in the specified shell (powershell, cmd, gitbash, bash, wsl)

IMPORTANT GUIDELINES:

  1. ALWAYS use the workingDir parameter to specify the working directory

  2. Request config of this MCP server configuration using tools

  3. Follow limitations taken from configuration

  4. Use validate_directories tool to validate directories before execution

Shell-Specific Settings:

powershell:

  • Command timeout: 30s

  • Max command length: 2000 characters

  • Injection protection: enabled

  • Blocked operators: &, |, ;, `

  • Path format: Windows-style (C:\Users...)

cmd:

  • Command timeout: 30s

  • Max command length: 2000 characters

  • Injection protection: enabled

  • Blocked operators: &, |, ;, `

  • Path format: Windows-style (C:\Users...)

gitbash:

  • Command timeout: 30s

  • Max command length: 2000 characters

  • Injection protection: enabled

  • Blocked operators: &, |, ;, `

  • Path format: Mixed (C:... or /c/...)

bash:

  • Command timeout: 30s

  • Max command length: 2000 characters

  • Injection protection: enabled

  • Blocked operators: &, |, ;, `

  • Path format: Unix-style (/home/user, /mnt/c/...)

  • Inherits global Windows paths (converted to /mnt/...)

wsl:

  • Command timeout: 30s

  • Max command length: 2000 characters

  • Injection protection: enabled

  • Blocked operators: &, |, ;, `

  • Path format: Unix-style (/home/user, /mnt/c/...)

  • Inherits global Windows paths (converted to /mnt/...)

Working Directory:

  • If omitted, uses the server's current directory

  • Must be within allowed paths for the selected shell

  • Must use the correct format for the shell type

Output Truncation:

  • Output is automatically truncated if it exceeds the configured limit

  • Current limit: 20 lines

  • Use maxOutputLines parameter to override the limit for a specific command

  • If truncated, use get_command_output tool with the executionId to retrieve full output

  • When file logging is enabled (via logDirectory), full logs are also saved to disk

Examples:

Windows CMD:

{
  "shell": "cmd",
  "command": "dir /b",
  "workingDir": "C:\\Projects"
}

WSL:

{
  "shell": "wsl",
  "command": "ls -la",
  "workingDir": "/home/user",
  "maxOutputLines": 50
}

Bash:

{
  "shell": "bash",
  "command": "ls -la",
  "workingDir": "/home/user",
  "maxOutputLines": 50
}

Git Bash:

{
  "shell": "gitbash",
  "command": "git status",
  "workingDir": "/c/Projects/repo"  // or "C:\Projects\repo"
}

With custom output limit:

{
  "shell": "gitbash",
  "command": "git log --oneline -50",
  "workingDir": "/c/Projects/repo",
  "maxOutputLines": 100
}

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
shellYesShell to use for command execution
commandYesCommand to execute. Note: Different shells have different blocked commands and operators.
workingDirNoWorking directory (optional). Format depends on shell type: - Windows shells: Use C:\Path\Format - Unix/WSL shells: Use /unix/path/format - Mixed shells: Both formats accepted
maxOutputLinesNoMaximum number of output lines to return (optional, overrides global setting). Must be a positive integer between 1 and 10,000.
Behavior5/5

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

With no annotations provided, the description carries full burden and delivers comprehensive behavioral details: command timeouts (30s), max command length (2000 chars), injection protection, blocked operators (&, |, ;, `), path formats per shell, output truncation (20 lines default), file logging behavior, and working directory defaults. This exceeds expectations for a tool with no annotations.

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

Conciseness3/5

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

The description is comprehensive but lengthy with repetitive shell-specific sections. While well-structured with clear headings, it could be more concise by consolidating common settings (e.g., timeout, max length, injection protection apply to all shells). The examples section is valuable but adds bulk.

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

Completeness5/5

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

For a complex command execution tool with no annotations and no output schema, the description provides exceptional completeness: covers all behavioral aspects, parameter usage, shell differences, error handling (truncation, get_command_output fallback), security constraints, and integration with sibling tools. Nothing essential appears missing.

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

Parameters4/5

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

Schema description coverage is 100%, so baseline is 3. The description adds significant value beyond schema: it explains shell-specific settings (timeouts, blocked operators, path formats), provides detailed working directory guidance, explains maxOutputLines override behavior, and gives concrete examples showing parameter usage in context.

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: 'Execute a command in the specified shell' with explicit shell options listed. It distinguishes from siblings like get_command_output (retrieves output) and validate_directories (validates paths) by focusing on command execution.

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

Usage Guidelines5/5

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

The description provides explicit guidelines: 'ALWAYS use the workingDir parameter', 'Request config of this MCP server configuration using tools', 'Follow limitations taken from configuration', and 'Use validate_directories tool to validate directories before execution'. It also distinguishes when to use get_command_output for truncated output.

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/s2005/wcli0'

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