Skip to main content
Glama
StrawHatAI

Claude Desktop Commander MCP

by StrawHatAI

execute_command

Execute terminal commands with timeout control, allowing background continuation for long-running operations.

Instructions

Execute a terminal command with timeout. Command will continue running in background if it doesn't complete within timeout.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes
timeout_msNo

Implementation Reference

  • The core handler function for the 'execute_command' tool. Parses input arguments, validates the command, executes via terminalManager, and formats the response with PID and initial output.
    export async function executeCommand(args: unknown) {
      const parsed = ExecuteCommandArgsSchema.safeParse(args);
      if (!parsed.success) {
        throw new Error(`Invalid arguments for execute_command: ${parsed.error}`);
      }
    
      if (!commandManager.validateCommand(parsed.data.command)) {
        throw new Error(`Command not allowed: ${parsed.data.command}`);
      }
    
      const result = await terminalManager.executeCommand(
        parsed.data.command,
        parsed.data.timeout_ms
      );
    
      return {
        content: [{
          type: "text",
          text: `Command started with PID ${result.pid}\nInitial output:\n${result.output}${
            result.isBlocked ? '\nCommand is still running. Use read_output to get more output.' : ''
          }`
        }],
      };
    }
  • Zod schema for execute_command input: 'command' (string, required), 'timeout_ms' (number, optional).
    export const ExecuteCommandArgsSchema = z.object({
      command: z.string(),
      timeout_ms: z.number().optional(),
    });
  • src/server.ts:60-65 (registration)
    Tool registration in the MCP server's listTools response, defining name, description, and input schema.
    {
      name: "execute_command",
      description:
        "Execute a terminal command with timeout. Command will continue running in background if it doesn't complete within timeout.",
      inputSchema: zodToJsonSchema(ExecuteCommandArgsSchema),
    },
  • src/server.ts:216-219 (registration)
    Dispatch logic in callTool handler that routes 'execute_command' calls to the handler function after parsing arguments.
    case "execute_command": {
      const parsed = ExecuteCommandArgsSchema.parse(args);
      return executeCommand(parsed);
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It adds valuable context about timeout handling and background execution, which aren't obvious from the schema. However, it lacks details on permissions, side effects, error handling, or output format, leaving significant gaps for a tool that executes commands.

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 extremely concise—two sentences that directly state the tool's function and a key behavioral trait. Every word serves a purpose, with no redundant information, making it efficiently front-loaded and easy to parse.

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

Completeness2/5

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

Given the tool's complexity (executing terminal commands), lack of annotations, no output schema, and low schema coverage, the description is incomplete. It misses critical details like security implications, error responses, or how results are returned, which are essential for safe and effective use.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate for undocumented parameters. It mentions 'timeout' but doesn't explain the 'timeout_ms' parameter's units or default behavior, and it doesn't clarify the 'command' parameter's scope or restrictions. The description adds minimal semantic value beyond the schema's structure.

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

Purpose4/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 terminal command with timeout.' It specifies the verb ('execute') and resource ('terminal command'), making the function unambiguous. However, it doesn't differentiate from sibling tools like 'block_command' or 'force_terminate', which prevents a perfect score.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention sibling tools like 'block_command' for restricting commands or 'force_terminate' for stopping processes, nor does it specify prerequisites or exclusions. This leaves the agent without contextual usage cues.

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/StrawHatAI/claude-dev-tools'

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