Skip to main content
Glama
ConnorBoetig-dev

Unrestricted Development MCP Server

docker_compose_down

Stop and remove Docker containers and networks created by docker-compose up, with options to delete volumes and orphaned containers for clean environment management.

Instructions

Stop and remove containers, networks created by docker-compose up

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
volumesNoRemove named volumes
removeOrphansNoRemove containers for services not in compose file
fileNoPath to compose file
cwdNoWorking directory

Implementation Reference

  • The main handler function that constructs and executes the 'docker compose down' command with options for volumes, orphans, compose file, and working directory.
    export async function dockerComposeDown(args: z.infer<typeof dockerComposeDownSchema>): Promise<ToolResponse> {
      const volumesFlag = args.volumes ? '-v' : '';
      const orphansFlag = args.removeOrphans ? '--remove-orphans' : '';
      const fileFlag = args.file ? `-f ${args.file}` : '';
      const composeCmd = await getComposeCmd();
    
      return executeDockerCommand(
        `${composeCmd} ${fileFlag} down ${volumesFlag} ${orphansFlag}`.trim(),
        args.cwd
      );
    }
  • Zod schema used for runtime input validation of the docker_compose_down tool parameters.
    export const dockerComposeDownSchema = z.object({
      volumes: z.boolean().optional().default(false).describe('Remove named volumes'),
      removeOrphans: z.boolean().optional().default(false).describe('Remove containers for services not in compose file'),
      file: z.string().optional().describe('Path to compose file'),
      cwd: z.string().optional().describe('Working directory')
    });
  • MCP tool definition/registration in the dockerTools array, including JSON schema for tool listing.
    {
      name: 'docker_compose_down',
      description: 'Stop and remove containers, networks created by docker-compose up',
      inputSchema: {
        type: 'object',
        properties: {
          volumes: { type: 'boolean', default: false, description: 'Remove named volumes' },
          removeOrphans: { type: 'boolean', default: false, description: 'Remove containers for services not in compose file' },
          file: { type: 'string', description: 'Path to compose file' },
          cwd: { type: 'string', description: 'Working directory' }
        }
      }
    },
  • src/index.ts:487-489 (registration)
    Runtime dispatch/registration in the main CallToolRequest handler that routes calls to the dockerComposeDown function after schema validation.
    if (name === 'docker_compose_down') {
      const validated = dockerComposeDownSchema.parse(args);
      return await dockerComposeDown(validated);
  • Core helper function used by all Docker tools, including dockerComposeDown, to execute shell commands and format responses.
    async function executeDockerCommand(command: string, cwd?: string): Promise<ToolResponse> {
      try {
        const { stdout, stderr } = await execAsync(command, {
          cwd: cwd || process.cwd(),
          shell: '/bin/bash',
          maxBuffer: 10 * 1024 * 1024, // 10MB buffer for logs
          timeout: 60000 // 60 second timeout for builds
        });
    
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: true,
                command: command,
                stdout: stdout.trim(),
                stderr: stderr.trim(),
                cwd: cwd || process.cwd()
              }, null, 2)
            }
          ]
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text" as const,
              text: JSON.stringify({
                success: false,
                command: command,
                stdout: error.stdout?.trim() || '',
                stderr: error.stderr?.trim() || error.message,
                exitCode: error.code || 1,
                cwd: cwd || process.cwd()
              }, null, 2)
            }
          ],
          isError: true
        };
      }
    }
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. It discloses the destructive nature ('remove') but lacks details on permissions needed, side effects (e.g., data loss if volumes aren't handled), rate limits, or error conditions. The description is minimal and doesn't compensate for the absence of annotations.

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 with zero waste—it directly states the tool's action and target. It's appropriately sized and front-loaded, making it easy to parse quickly.

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 tool's complexity (destructive operation with 4 parameters), no annotations, and no output schema, the description is inadequate. It doesn't explain return values, error handling, or behavioral nuances, leaving significant gaps for an AI agent to understand how to invoke it correctly.

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 fully documents all 4 parameters. The description adds no parameter-specific information beyond what's in the schema, meeting the baseline of 3 where the schema does the heavy lifting.

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 ('Stop and remove') and target resources ('containers, networks created by docker-compose up'), providing a specific verb+resource combination. However, it doesn't explicitly differentiate from sibling tools like 'docker_stop' or 'docker_rm', which might handle similar operations differently.

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?

No guidance is provided on when to use this tool versus alternatives like 'docker_stop' (which stops but doesn't remove) or 'docker_rm' (which removes but doesn't stop first). The description implies usage after 'docker-compose up' but doesn't specify prerequisites or exclusions.

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/ConnorBoetig-dev/mcp2'

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