Skip to main content
Glama

docker_volumes

List, create, remove, inspect, or prune Docker volumes. Use volume name, driver, filter, or force flags to manage container storage effectively.

Instructions

Manage Docker volumes

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform on volumes
volumeNoVolume name
driverNoVolume driver
forceNoForce operation
filterNoFilter results

Implementation Reference

  • Interface DockerVolumeArgs defining input schema for the docker_volumes tool: action (enum: list/create/remove/inspect/prune), volume, driver, label, opt, force, filter, all.
    export interface DockerVolumeArgs {
      action: 'list' | 'create' | 'remove' | 'inspect' | 'prune';
      volume?: string;
      driver?: string;
      label?: Record<string, string>;
      opt?: Record<string, string>;
      force?: boolean;
      filter?: string;
      all?: boolean;
    }
  • manageVolumes method - the handler that executes docker_volumes tool logic. Builds docker volume CLI commands based on action (list, create, remove, inspect, prune) and runs them via executeDockerCommand.
    async manageVolumes(args: DockerVolumeArgs): Promise<ToolResult> {
      const { action, volume, driver, label, opt, force, filter, all } = args;
    
      ValidationUtils.validateRequired({ action }, ['action']);
    
      let command = 'docker volume';
    
      switch (action) {
        case 'list':
          command = 'docker volume ls';
          if (filter) command += ` --filter ${filter}`;
          break;
          
        case 'create':
          if (!volume) throw new Error('Volume name is required for create action');
          command = `docker volume create ${volume}`;
          if (driver) command += ` --driver ${driver}`;
          
          if (label) {
            for (const [key, value] of Object.entries(label)) {
              command += ` --label ${key}=${value}`;
            }
          }
          
          if (opt) {
            for (const [key, value] of Object.entries(opt)) {
              command += ` --opt ${key}=${value}`;
            }
          }
          break;
          
        case 'remove':
          if (!volume) throw new Error('Volume name is required for remove action');
          command = `docker volume rm ${volume}`;
          if (force) command += ' -f';
          break;
          
        case 'inspect':
          if (!volume) throw new Error('Volume name is required for inspect action');
          command = `docker volume inspect ${volume}`;
          break;
          
        case 'prune':
          command = 'docker volume prune';
          if (force) command += ' -f';
          if (filter) command += ` --filter ${filter}`;
          if (all) command += ' -a';
          break;
          
        default:
          throw new Error(`Unsupported volume action: ${action}`);
      }
    
      try {
        return await this.executeDockerCommand(command, { cwd: this.getCurrentWorkspace() });
      } catch (error: any) {
        throw new Error(`Docker volume ${action} failed: ${error.message}`);
      }
    }
  • Tool definition registration for 'docker_volumes' with name, description, and inputSchema specifying action enum and optional properties (volume, driver, force, filter).
    {
      name: 'docker_volumes',
      description: 'Manage Docker volumes',
      inputSchema: {
        type: 'object',
        properties: {
          action: { 
            type: 'string', 
            enum: ['list', 'create', 'remove', 'inspect', 'prune'],
            description: 'Action to perform on volumes' 
          },
          volume: { type: 'string', description: 'Volume name' },
          driver: { type: 'string', description: 'Volume driver' },
          force: { type: 'boolean', description: 'Force operation' },
          filter: { type: 'string', description: 'Filter results' },
        },
        required: ['action'],
      },
    },
  • src/index.ts:217-218 (registration)
    Routing registration - case 'docker_volumes' dispatches to dockerService.manageVolumes.
    case 'docker_volumes':
      return await this.dockerService.manageVolumes(args as DockerVolumeArgs);
Behavior2/5

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

No annotations are provided, so the description must bear the burden of behavioral disclosure. The single sentence 'Manage Docker volumes' does not reveal any behavioral traits such as destructive actions (remove, prune), side effects, or required permissions. The input schema shows action enum including potentially destructive operations, but the description offers no transparency.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is short (one sentence), but it sacrifices clarity for brevity. It is not front-loaded with the most important information (the available actions). While concise, it is under-specified and fails to convey the tool's core functionality effectively.

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 the tool (5 parameters, multiple actions, no output schema, no annotations), the description is insufficiently complete. It does not explain return values, error conditions, or prerequisites (e.g., Docker must be running). The schema helps, but the description should provide context for the agent to understand the tool's full behavior.

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 input schema already documents all five parameters with descriptions. The description adds no additional meaning beyond the schema, such as clarifying the relationship between action and other parameters (e.g., which actions require volume name). Baseline 3 is appropriate given full schema coverage.

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

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Manage Docker volumes' identifies the resource but is vague. It does not specify the specific actions (list, create, remove, inspect, prune) that the tool performs, which are provided in the input schema. Sibling tools like docker_containers and docker_images indicate similar management tools, but this description lacks operational specificity.

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 sibling tools such as docker_containers or docker_images. The description does not clarify appropriate contexts or scenarios for managing volumes compared to other Docker resources.

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