Skip to main content
Glama
dillip285

MCP Terminal Server

by dillip285

execute_command

Run system commands locally on the MCP Terminal Server, specifying the command, arguments, and working directory for secure and controlled execution in the operating system environment.

Instructions

Execute a command in the local system

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
argsNoCommand arguments
commandYesCommand to execute
cwdNoWorking directory for command execution

Implementation Reference

  • Handler function that parses input using ExecuteCommandSchema and executes the command using execa, returning stdout/stderr or error.
    if (name === "execute_command") {
      const { command, args: cmdArgs = [], cwd } = ExecuteCommandSchema.parse(args);
      
      try {
        const result = await execa(command, cmdArgs, {
          cwd,
          shell: true,
        });
    
        return {
          content: [
            {
              type: "text",
              text: result.stdout || result.stderr || 'Command executed successfully with no output',
            },
          ],
          isError: false,
        };
      } catch (execaError: any) {
        return {
          content: [
            {
              type: "text",
              text: execaError?.message || 'Command execution failed',
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema for validating the input parameters of the execute_command tool: command (required), args (optional array), cwd (optional).
    const ExecuteCommandSchema = z.object({
      command: z.string(),
      args: z.array(z.string()).optional(),
      cwd: z.string().optional(),
    });
  • src/index.ts:37-56 (registration)
    Tool registration in the listTools response, including name, description, and JSON schema mirroring the Zod schema.
    {
      name: "execute_command",
      description: "Execute a command in the local system",
      inputSchema: {
        type: "object",
        properties: {
          command: { type: "string", description: "Command to execute" },
          args: { 
            type: "array", 
            items: { type: "string" },
            description: "Command arguments"
          },
          cwd: { 
            type: "string", 
            description: "Working directory for command execution"
          }
        },
        required: ["command"],
      },
    }
Behavior2/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. While 'execute a command' implies a potentially powerful/mutating operation, it doesn't disclose critical behavioral traits like security implications, permission requirements, side effects, error handling, or output format. This leaves significant gaps for an AI agent to understand the tool's behavior.

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 - a single sentence that directly states the tool's purpose without any unnecessary words. It's perfectly front-loaded with the essential information.

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?

For a tool that executes system commands (a potentially dangerous operation with no output schema), the description is severely lacking. It doesn't address security implications, permission requirements, typical use cases, error handling, or what kind of output/result to expect. The absence of annotations exacerbates these gaps.

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%, meaning all parameters are documented in the schema itself. The description doesn't add any meaningful parameter semantics beyond what's already in the schema (command, args, cwd). 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.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('execute') and target ('a command in the local system'), providing a specific verb+resource combination. However, since there are no sibling tools mentioned, it cannot demonstrate differentiation from alternatives, preventing a perfect score of 5.

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, nor does it mention any prerequisites, constraints, or typical use cases. It simply states what the tool does without contextual usage information.

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

Related 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/dillip285/mcp-terminal'

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