Skip to main content
Glama

run_command

Execute shell commands like npm install or build in a sandboxed project environment for web development automation.

Instructions

Execute a shell command in the project sandbox (e.g. npm install, npm run build). Max timeout 5 minutes.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID (UUID or url_id)
commandYesShell command to execute
cwdNoWorking directory (default: /home/user/project)
timeout_msNoTimeout in milliseconds (default: 120000, max: 300000)

Implementation Reference

  • The handler function for the run_command tool. It calls client.runCommand() with parameters (project_id, command, cwd, timeout_ms), formats the output showing exit code, stdout, and stderr, and handles errors.
    async (params) => {
      try {
        const result = await client.runCommand(params.project_id, {
          command: params.command,
          cwd: params.cwd,
          timeout_ms: params.timeout_ms,
        });
    
        let text = `Exit code: ${result.exit_code}`;
    
        if (result.stdout) {
          text += `\n\nSTDOUT:\n${result.stdout}`;
        }
    
        if (result.stderr) {
          text += `\n\nSTDERR:\n${result.stderr}`;
        }
    
        return { content: [{ type: 'text' as const, text }] };
      } catch (err: any) {
        return { content: [{ type: 'text' as const, text: `Error: ${err.message}` }], isError: true };
      }
    },
  • The runCommand method in AICre8Client class that makes the actual POST request to /projects/{projectId}/run endpoint with command parameters and returns exit_code, stdout, and stderr.
    async runCommand(
      projectId: string,
      params: { command: string; cwd?: string; timeout_ms?: number },
    ): Promise<{ exit_code: number; stdout: string; stderr: string }> {
      return this.request('POST', `/projects/${projectId}/run`, params);
    }
  • src/index.ts:188-189 (registration)
    Registration of the run_command tool with the MCP server using server.tool() method.
    server.tool(
      'run_command',
  • Zod schema definition for run_command tool parameters: project_id (required), command (required), cwd (optional), and timeout_ms (optional with max 300000ms).
    {
      project_id: z.string().describe('Project ID (UUID or url_id)'),
      command: z.string().describe('Shell command to execute'),
      cwd: z.string().optional().describe('Working directory (default: /home/user/project)'),
      timeout_ms: z
        .number()
        .optional()
        .describe('Timeout in milliseconds (default: 120000, max: 300000)'),
    },
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 context about the timeout constraint (5 minutes max) and the sandbox environment, which is useful. However, it doesn't cover critical aspects like security implications, error handling, output format, or whether commands are executed with specific permissions, leaving significant gaps for a tool that executes arbitrary shell 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 highly concise with just two sentences that directly convey the core functionality and a key constraint. Every word earns its place, and it's front-loaded with the main purpose, making it efficient and easy to parse.

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

Completeness3/5

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

Given the complexity of executing arbitrary shell commands (a high-risk operation), no annotations, and no output schema, the description is incomplete. It covers the basic purpose and timeout but lacks details on security, error handling, return values, or dependencies on other tools like 'create_project'. For such a tool, more context is needed to ensure safe and effective use.

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?

Schema description coverage is 100%, so the schema already documents all 4 parameters thoroughly. The description doesn't add any parameter-specific details beyond what's in the schema (e.g., it doesn't explain 'project_id' or 'cwd' further). Baseline 3 is appropriate when the schema does the heavy lifting, though no extra value is provided.

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 'execute' and resource 'shell command in the project sandbox', with examples like 'npm install, npm run build' that make the purpose specific and understandable. However, it doesn't explicitly differentiate from sibling tools like 'deploy_project' or 'generate_code', which might also involve command execution in some contexts.

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 for executing shell commands in a project sandbox, but doesn't provide explicit guidance on when to use this versus alternatives like 'deploy_project' or 'generate_code'. It mentions a 'max timeout 5 minutes', which offers some operational context but no clear when-not-to-use or prerequisite 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

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/AICre8dev/mcp-server'

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