Skip to main content
Glama
theburgerllc

AI Development Pipeline MCP

by theburgerllc

run_shell_command

Execute whitelisted shell commands for development tasks like npm, git, node, and code quality tools within the AI Development Pipeline workspace.

Instructions

Run a whitelisted shell command in the workspace (npm, yarn, git, node, npx, tsc, eslint, prettier)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commandYes

Implementation Reference

  • Handler function that validates the command using validateCommand, executes the shell command with child_process.exec limited to workspace cwd, 30s timeout, 1MB buffer, sanitizes output by removing control characters, and returns the stdout or error as content.
    async ({ command }) => {
      return new Promise((resolve) => {
        try {
          validateCommand(command);
          exec(command, {
            cwd: WORKSPACE_ROOT,
            timeout: 30000, // 30 second timeout
            maxBuffer: 1024 * 1024 // 1MB max output
          }, (error, stdout, stderr) => {
            if (error) {
              resolve({
                content: [{ type: 'text', text: `Error: ${stderr || error.message}` }]
              });
            } else {
              // Sanitize output to prevent log injection
              const sanitizedOutput = stdout.replace(/[\x00-\x1f\x7f-\x9f]/g, '');
              resolve({
                content: [{ type: 'text', text: sanitizedOutput }]
              });
            }
          });
        } catch (err: any) {
          resolve({
            content: [{ type: 'text', text: `Security error: ${err.message}` }]
          });
        }
      });
    }
  • Input schema defining the 'command' parameter as a Zod string.
    { command: z.string() },
  • MCP server tool registration for 'run_shell_command' with description, schema, and handler.
    server.tool(
      'run_shell_command',
      'Run a whitelisted shell command in the workspace (npm, yarn, git, node, npx, tsc, eslint, prettier)',
      { command: z.string() },
      async ({ command }) => {
        return new Promise((resolve) => {
          try {
            validateCommand(command);
            exec(command, {
              cwd: WORKSPACE_ROOT,
              timeout: 30000, // 30 second timeout
              maxBuffer: 1024 * 1024 // 1MB max output
            }, (error, stdout, stderr) => {
              if (error) {
                resolve({
                  content: [{ type: 'text', text: `Error: ${stderr || error.message}` }]
                });
              } else {
                // Sanitize output to prevent log injection
                const sanitizedOutput = stdout.replace(/[\x00-\x1f\x7f-\x9f]/g, '');
                resolve({
                  content: [{ type: 'text', text: sanitizedOutput }]
                });
              }
            });
          } catch (err: any) {
            resolve({
              content: [{ type: 'text', text: `Security error: ${err.message}` }]
            });
          }
        });
      }
    );
  • Helper to validate the base command is whitelisted by splitting on whitespace and checking against ALLOWED_COMMANDS.
    function validateCommand(command: string): void {
      const commandParts = command.trim().split(/\s+/);
      const baseCommand = commandParts[0];
    
      if (!ALLOWED_COMMANDS.includes(baseCommand)) {
        throw new Error(`Command '${baseCommand}' is not allowed`);
      }
    }
  • Constant array defining allowed base commands for shell execution.
    const ALLOWED_COMMANDS = [
      'npm', 'yarn', 'git', 'node', 'npx', 'tsc', 'eslint', 'prettier'
    ];
Behavior2/5

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

With no annotations provided, the description carries full burden. It mentions 'whitelisted' which hints at security restrictions, but doesn't disclose critical behavioral traits: whether this requires specific permissions, if commands run synchronously/asynchronously, what happens on errors, output format, or workspace context implications. For a shell command execution tool with zero annotation coverage, this leaves significant gaps in understanding how it behaves.

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 a single, efficient sentence that front-loads the core purpose ('Run a whitelisted shell command in the workspace') and provides relevant examples. Every word earns its place with no redundancy or wasted text, making it highly concise and well-structured.

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 shell command execution (potentially destructive, security-sensitive), no annotations, no output schema, and minimal parameter documentation, the description is incomplete. It should address safety, permissions, error handling, and output expectations to be adequate for safe and effective use by an AI agent.

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% (no parameter descriptions in schema), and the single parameter 'command' is undocumented. The description adds minimal semantics by implying the command should be from a whitelisted set (npm, yarn, etc.), but doesn't explain format, syntax, or constraints beyond listing examples. For a tool with 1 parameter at 0% coverage, this doesn't adequately compensate.

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 verb 'Run' and specifies the resource as 'a whitelisted shell command in the workspace', listing specific examples (npm, yarn, git, etc.). It distinguishes from siblings like check_file_exists or list_directory_files by focusing on command execution rather than file operations. However, it doesn't explicitly differentiate from run_project_tests or run_augment_prompt, which might also involve execution.

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 implies usage context by mentioning 'whitelisted shell command' and listing specific tools, suggesting this is for running development/workspace commands. However, it provides no explicit guidance on when to use this versus alternatives like run_project_tests or run_augment_prompt, nor does it mention prerequisites or exclusions (e.g., only for workspace commands, not arbitrary shell commands).

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/theburgerllc/ai-development-pipeline-mcp'

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