Skip to main content
Glama
s2005

Windows CLI MCP Server

by s2005

execute_command

Execute commands in bash shell with configurable working directory, output limit, and timeout for secure Windows CLI interactions.

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?

Despite no annotations, the description fully discloses behavioral traits: timeout (30s), max command length (2000 chars), injection protection, blocked operators, output truncation (20 lines default), ability to override, and path format requirements. It leaves no ambiguity for the agent.

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 lengthy but well-structured with headings, tables, and examples. It is front-loaded with crucial guidelines. Some repetition across shell sections could be condensed, but overall it efficiently provides necessary detail for a complex tool.

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?

Given 5 parameters, no output schema, and no annotations, the description covers all aspects: shell-specific settings, working directory, output truncation, timeout, and examples. It also references sibling tools for additional actions, making it complete for an agent to use effectively.

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?

Although schema coverage is 100%, the description adds substantial meaning beyond the schema: per-shell settings, allowed values for maxOutputLines (1-10,000) and timeout (1-3600s), path format examples, and context for workingDir. The examples further clarify usage.

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' and lists supported shells (powershell, cmd, gitbash, bash, wsl). It distinguishes itself from sibling tools like get_command_output and validate_directories by being the primary execution tool.

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 workingDir, validate directories first, follow configuration, and details for each shell. It also explains when to use get_command_output for truncated output, offering clear context for 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/s2005/wcli0'

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