Skip to main content
Glama
koopatroopa787

MCP PC Control Server

execute_command

Run shell commands on your system to automate tasks, manage files, and control PC operations through direct command execution.

Instructions

Execute shell commands on the system. SECURITY WARNING: This tool provides direct system access. Only use with trusted commands. Commands run with the same permissions as the MCP server process.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesThe shell command to execute
workingDirectoryNoThe working directory for command execution (optional)

Implementation Reference

  • Handler for the 'execute_command' tool. Executes the shell command using the promisified 'exec' function from Node.js child_process module, with optional working directory. Returns stdout, stderr, and success status in JSON format.
    case "execute_command": {
      const command = args.command as string;
      const workingDirectory = args.workingDirectory as string | undefined;
    
      const options = workingDirectory ? { cwd: workingDirectory } : {};
      const { stdout, stderr } = await execAsync(command, options);
    
      return {
        content: [
          {
            type: "text",
            text: JSON.stringify(
              {
                stdout: stdout,
                stderr: stderr,
                success: true,
              },
              null,
              2
            ),
          },
        ],
      };
    }
  • Input schema definition for the 'execute_command' tool, specifying a required 'command' string parameter and an optional 'workingDirectory' string.
    inputSchema: {
      type: "object",
      properties: {
        command: {
          type: "string",
          description: "The shell command to execute",
        },
        workingDirectory: {
          type: "string",
          description: "The working directory for command execution (optional)",
        },
      },
      required: ["command"],
    },
  • src/index.ts:172-189 (registration)
    Registration of the 'execute_command' tool in the TOOLS array, which is returned by the ListTools handler. Includes name, description, and input schema.
    {
      name: "execute_command",
      description: "Execute shell commands on the system. SECURITY WARNING: This tool provides direct system access. Only use with trusted commands. Commands run with the same permissions as the MCP server process.",
      inputSchema: {
        type: "object",
        properties: {
          command: {
            type: "string",
            description: "The shell command to execute",
          },
          workingDirectory: {
            type: "string",
            description: "The working directory for command execution (optional)",
          },
        },
        required: ["command"],
      },
    },
Behavior4/5

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

With no annotations provided, the description carries full burden and does an excellent job disclosing critical behavioral traits: security implications ('direct system access'), permission context ('run with the same permissions as the MCP server process'), and trust requirements. It doesn't contradict any annotations since none exist, and provides substantial behavioral context beyond what the input schema offers.

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 perfectly front-loaded with the core purpose, followed by critical warnings and context. Every sentence earns its place: the first states what it does, the second provides security warning, the third gives usage guidance, and the fourth explains permission context. No wasted words.

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

Completeness4/5

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

For a high-risk tool with no annotations and no output schema, the description provides excellent contextual completeness regarding security, permissions, and usage constraints. It appropriately focuses on the critical behavioral aspects rather than trying to explain return values (which would be needed if there was an output schema). The only minor gap is not explicitly mentioning what happens with command output.

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%, so both parameters are well-documented in the schema. The description doesn't add specific parameter semantics beyond what's in the schema (command execution and optional working directory). This meets the baseline expectation when schema coverage is complete.

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 specific action ('execute shell commands') and resource ('on the system'), distinguishing it from sibling tools like create_directory or edit_file which perform file operations rather than arbitrary command execution. It precisely defines what the tool does without being vague or tautological.

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 guidance on when to use this tool ('Only use with trusted commands') and strongly implies when not to use it (for untrusted commands). It distinguishes this tool from siblings by highlighting its direct system access nature, which is not present in file operation tools like list_directory or read_file.

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/koopatroopa787/first_mcp'

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