Skip to main content
Glama

docker_cleanup

Removes unused Docker containers and resources tracked by the Code MCP Server to free up system space and maintain a clean development environment.

Instructions

Clean up tracked Docker containers and resources

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes docker_cleanup logic. Iterates over tracked containers (runningContainers map), stops and removes each one, and returns results.
    async cleanupTrackedContainers(): Promise<ToolResult> {
      const results: string[] = [];
      
      for (const [name, info] of this.runningContainers) {
        try {
          await this.manageContainers({ action: 'stop', container: name });
          await this.manageContainers({ action: 'remove', container: name, force: true });
          this.runningContainers.delete(name);
          results.push(`✅ Cleaned up container: ${name}`);
        } catch (error: any) {
          results.push(`❌ Failed to cleanup container ${name}: ${error.message}`);
        }
      }
    
      return {
        content: [{
          type: 'text',
          text: results.join('\n') || 'No tracked containers to clean up',
        }],
      };
    }
  • Schema definition for docker_cleanup tool - no input parameters, just description and empty inputSchema.
    {
      name: 'docker_cleanup',
      description: 'Clean up tracked Docker containers and resources',
      inputSchema: {
        type: 'object',
        properties: {},
      },
    },
  • src/index.ts:225-226 (registration)
    Registration/case statement that routes 'docker_cleanup' to DockerService.cleanupTrackedContainers().
    case 'docker_cleanup':
      return await this.dockerService.cleanupTrackedContainers();
  • The runningContainers Map that stores tracked containers used by the cleanup handler.
    private runningContainers: Map<string, any> = new Map();
Behavior2/5

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

With no annotations and no output schema, the description does not disclose what 'clean up' entails (e.g., deletion, pruning, stopping), potential side effects (destructive vs safe), or what 'tracked' means. The agent lacks critical behavioral insight.

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 a single concise sentence with no redundant words. It could be slightly more informative without losing conciseness.

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 zero parameters, no output schema, and many sibling Docker tools, the description lacks specifics about what resources are affected (all containers vs only tracked ones), whether it's idempotent, or if it requires prior setup. The agent may be uncertain about using this tool safely.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has zero parameters, so schema_description_coverage is 100%. No parameter information is needed, and the description does not need to add meaning beyond the schema. Baseline 4 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/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 ('clean up') and resource ('tracked Docker containers and resources'), which distinguishes it from sibling tools like docker_containers (listing) and docker_images (image management).

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_cleanup vs docker_system or other cleanup commands. The description lacks context for appropriate usage scenarios.

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/agentics-ai/code-mcp'

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