Skip to main content
Glama
Toowiredd

ChatGPT MCP Server

container_exec

Execute commands in running Docker containers to manage processes, troubleshoot issues, or perform administrative tasks directly from the ChatGPT interface.

Instructions

Execute a command in a running container

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
containerYesContainer ID or name
commandYesCommand to execute

Implementation Reference

  • Core implementation of container_exec tool: executes `docker exec <container> <command>` via the generic executeCommand method.
    async execInContainer(id: string, command: string): Promise<string> {
      return this.executeCommand(`exec ${id} ${command}`);
    }
  • Dispatch handler in MCP server for the 'container_exec' tool call, which parses arguments and invokes DockerService.execInContainer.
    case 'container_exec': {
      const { container, command } = request.params.arguments as {
        container: string;
        command: string;
      };
      const output = await this.dockerService.execInContainer(container, command);
      return {
        content: [{ type: 'text', text: output }],
      };
    }
  • Input schema and metadata for the 'container_exec' tool, defining required parameters 'container' and 'command'.
    {
      name: 'container_exec',
      description: 'Execute a command in a running container',
      inputSchema: {
        type: 'object',
        properties: {
          container: {
            type: 'string',
            description: 'Container ID or name',
          },
          command: {
            type: 'string',
            description: 'Command to execute',
          },
        },
        required: ['container', 'command'],
      },
    },
  • Generic helper method used by execInContainer (and other tools) to run arbitrary 'docker <command>' via child_process.exec.
    async executeCommand(command: string): Promise<string> {
      try {
        const { stdout } = await execAsync(`docker ${command}`);
        return stdout;
      } catch (error: any) {
        throw new McpError(
          ErrorCode.InternalError,
          `Docker command failed: ${error.message}`
        );
      }
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states the action ('Execute a command') but doesn't describe critical behavioral traits: whether this requires specific permissions, if it's interactive or batch, what happens to command output, potential side effects, or error conditions. For a tool that executes commands in containers, this leaves significant gaps in understanding its 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 a single, efficient sentence that states the core functionality without unnecessary words. It's appropriately sized for a tool with two parameters and no complex behavior described. Every word earns its place in conveying the essential purpose.

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 commands in containers (potentially destructive, permission-sensitive operations) with no annotations and no output schema, the description is insufficiently complete. It doesn't address security implications, output handling, error scenarios, or interaction patterns. The agent lacks critical context needed to use this tool 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?

Schema description coverage is 100%, with both parameters clearly documented in the schema. The description adds no additional parameter semantics beyond what's already in the structured schema. It doesn't provide examples, format details, or constraints beyond the basic definitions. This meets 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 action ('Execute a command') and target ('in a running container'), providing specific verb+resource. It distinguishes from siblings like container_create or container_logs by focusing on command execution rather than lifecycle management or log retrieval. However, it doesn't explicitly differentiate from all siblings (e.g., container_start also operates on containers).

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 prerequisites (e.g., container must be running), exclusions (e.g., not for stopped containers), or suggest alternatives among the sibling tools. The agent must infer usage context solely from the tool name and description.

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

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