Skip to main content
Glama
s2005

Windows CLI MCP Server

by s2005

execute_command

Execute shell commands in Windows environments with configurable working directory, timeout, and output lines, while adhering to security restrictions and shell-specific settings.

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/...)

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

Command Timeout:

  • Each shell has a default command timeout (see Shell-Specific Settings above)

  • Use timeout parameter to override the timeout for a specific command

  • Timeout must be a positive integer between 1 and 3,600 seconds (1 hour)

  • If the timeout is exceeded, the command will be terminated

Examples:

Windows CMD:

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

WSL:

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

With custom timeout:

{
  "shell": "wsl",
  "command": "long-running-command",
  "workingDir": "/home/user",
  "timeout": 120
}

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.
timeoutNoCommand timeout in seconds (optional, overrides global setting). Must be a positive integer between 1 and 3,600 (1 hour).
Behavior5/5

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

No annotations provided, so description carries full burden. It discloses timeouts, max command length, injection protection, blocked operators, output truncation, working directory behavior, and logging for each shell. Comprehensive behavioral disclosure.

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?

Well-structured with sections, bullet points, and examples. Front-loaded with purpose and guidelines. Every element earns its place; no fluff. Examples illustrate various shells and parameters.

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?

Despite no output schema, description covers all aspects: parameters, shell variations, output truncation, timeout handling, and references to sibling tools. Complete enough for an agent to use correctly.

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?

Schema coverage is 100%, baseline 3. Description adds extensive semantics: per-shell path formats, blocked operators, timeout/line overrides, and working directory format requirements. Significantly enriches parameter understanding beyond schema.

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 it executes a command in a specified shell, lists supported shells, and provides examples. It distinguishes from sibling tools like get_command_output and validate_directories by explaining their specific roles.

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?

Explicit guidelines include always using workingDir, following configuration, using validate_directories, and handling output truncation with get_command_output. The description provides clear when-to-use and when-not-to-use context.

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