Skip to main content
Glama

run_command

Execute allowed shell commands like clasp, npm, git, and dir to manage scripts, dependencies, version control, and directory operations within the Revenue Engine MCP server environment.

Instructions

Execute allowed shell commands (clasp, npm, git, dir). For clasp commands, run from apps-script folder.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYesCommand to run (must be in allowed list)
workingDirectoryNoDirectory to run command in (optional, defaults to revenue-engine-mcp)

Implementation Reference

  • Handler for run_command tool: validates command and directory, executes using child_process.execAsync, returns stdout/stderr.
    case "run_command": {
      const { command, workingDirectory } = args;
      
      if (!isCommandAllowed(command)) {
        throw new Error(`Command not allowed: ${command}. Allowed commands: ${Object.keys(ALLOWED_COMMANDS).join(', ')}`);
      }
    
      const cwd = workingDirectory || 'C:\\Users\\Node1\\revenue-engine-mcp';
      
      if (!isPathAllowed(cwd)) {
        throw new Error(`Working directory not allowed: ${cwd}`);
      }
    
      debugLog(`Running command: ${command} in ${cwd}`);
      
      const { stdout, stderr } = await execAsync(command, { cwd });
      
      result = {
        success: true,
        command: command,
        workingDirectory: cwd,
        stdout: stdout,
        stderr: stderr
      };
      break;
    }
  • index.js:595-612 (registration)
    Registration of run_command tool in ListTools response, including name, description, and input schema.
    {
      name: "run_command",
      description: "Execute allowed shell commands (clasp, npm, git, dir). For clasp commands, run from apps-script folder.",
      inputSchema: {
        type: "object",
        properties: {
          command: {
            type: "string",
            description: "Command to run (must be in allowed list)"
          },
          workingDirectory: {
            type: "string",
            description: "Directory to run command in (optional, defaults to revenue-engine-mcp)"
          }
        },
        required: ["command"]
      }
    }
  • Helper function to validate if a command is in the allowed list.
    function isCommandAllowed(command) {
      const cmd = command.trim();
      return Object.keys(ALLOWED_COMMANDS).some(allowed => 
        cmd.startsWith(allowed)
      );
    }
  • Configuration object listing all allowed commands for run_command.
    const ALLOWED_COMMANDS = {
      'clasp push': 'Sync local files to Google Apps Script',
      'clasp pull': 'Sync Google Apps Script to local files',
      'clasp deploy': 'Deploy Apps Script as web app',
      'clasp status': 'Check sync status',
      'clasp list': 'List Apps Script projects',
      'npm install': 'Install node packages',
      'git status': 'Check git status',
      'git add': 'Stage changes',
      'git commit': 'Commit changes',
      'git init': 'Initialize git repository',
      'git remote': 'Manage remote repositories',
      'git push': 'Push to remote',
      'git branch': 'Manage branches',
      'mkdir': 'Create directory',
      'md': 'Create directory (Windows)',
      'dir': 'List directory contents',
      'ls': 'List directory contents',
      'del': 'Delete files (Windows)',
      'rm': 'Remove files (Unix)',
    };
  • Helper function to check if working directory is allowed.
    function isPathAllowed(filePath) {
      const normalized = filePath.replace(/\//g, '\\');
      return ALLOWED_PATHS.some(allowedPath => 
        normalized.startsWith(allowedPath)
      );
    }
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions the allowed command list and a working directory default, but fails to disclose critical behavioral traits such as security implications, error handling, output format, permissions required, or rate limits. For a tool that executes shell commands—a potentially high-risk operation—this is a significant gap in transparency.

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 appropriately sized with two sentences that are front-loaded and efficient. The first sentence states the core purpose and allowed commands, while the second adds specific guidance for clasp commands. There is no wasted text, and each sentence earns its place by providing 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?

Given the complexity of executing shell commands (a high-risk operation), lack of annotations, and no output schema, the description is incomplete. It covers the basic purpose and some usage notes but omits critical context such as security warnings, output behavior, error handling, and permissions. For a tool with no structured safety indicators, this leaves significant gaps for an AI agent to use it safely and effectively.

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 input schema has 100% description coverage, with clear documentation for both parameters ('command' and 'workingDirectory'). The description adds marginal value by specifying the allowed command list (clasp, npm, git, dir) and a note about clasp commands, which provides context beyond the schema's generic 'must be in allowed list'. However, it doesn't elaborate on parameter syntax, examples, or constraints beyond what's in the schema, meeting the baseline for high schema coverage.

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 with a specific verb ('Execute') and resource ('allowed shell commands'), listing the allowed commands (clasp, npm, git, dir). It distinguishes this tool from siblings by focusing on shell command execution, unlike other tools that handle leads, tasks, files, or metrics. However, it doesn't explicitly differentiate from potential similar tools not present in the sibling list.

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

Usage Guidelines3/5

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

The description provides implied usage guidance by specifying allowed commands (clasp, npm, git, dir) and a special note for clasp commands ('run from apps-script folder'), which suggests when to use this tool for those specific operations. However, it lacks explicit when-not-to-use guidance or alternatives for other command types, and doesn't mention prerequisites or compare to other tools in the sibling list.

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/PromptishOperations/mcpSpec'

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