Skip to main content
Glama

remove_container

Remove Docker containers from your system. Specify container ID or name, and use force=true to stop and delete running containers.

Instructions

Remove a Docker container. Use force=true to remove running containers.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYesContainer ID or name
forceNoForce remove running container

Implementation Reference

  • The handler function that executes the remove_container tool logic. It gets a Docker container by ID and calls the Docker API's remove method with the force option.
    export async function removeContainer(
      id: string,
      force: boolean,
    ): Promise<string> {
      const container = docker.getContainer(id);
      await container.remove({ force });
      return `Container ${id} removed`;
    }
  • src/index.ts:100-115 (registration)
    Registration of the remove_container tool with the MCP server. Defines the tool name, description, input schema using Zod, and the handler that calls removeContainer.
    server.tool(
      "remove_container",
      "Remove a Docker container. Use force=true to remove running containers.",
      {
        id: z.string().describe("Container ID or name"),
        force: z
          .boolean()
          .optional()
          .default(false)
          .describe("Force remove running container"),
      },
      async ({ id, force }) => {
        const result = await removeContainer(id, force);
        return { content: [{ type: "text", text: result }] };
      },
    );
  • Zod schema definition for remove_container tool inputs: 'id' (required string for container ID/name) and 'force' (optional boolean, defaults to false, for force-removing running containers).
    {
      id: z.string().describe("Container ID or name"),
      force: z
        .boolean()
        .optional()
        .default(false)
        .describe("Force remove running container"),
    },
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 mentions the destructive nature ('Remove') and the force option for running containers, which are critical behavioral traits. However, it lacks details on permissions needed, whether removal is irreversible, or error handling, leaving room for improvement in transparency.

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 extremely concise with two sentences that are front-loaded and waste no words. The first sentence states the core purpose, and the second provides essential usage guidance, making it efficient and well-structured.

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 tool's complexity (a destructive operation with 2 parameters), no annotations, and no output schema, the description is minimally adequate. It covers the basic action and a key parameter nuance but lacks details on prerequisites, side effects, or return values, which would enhance completeness for such a tool.

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 both parameters ('id' and 'force') fully. The description adds minimal value by reiterating the 'force' parameter's purpose but doesn't provide additional syntax or format details beyond what the schema specifies, meeting the baseline for high coverage.

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 specific action ('Remove a Docker container') and resource ('Docker container'), distinguishing it from siblings like 'remove_image' (which targets images) and 'stop_container' (which stops but doesn't remove). It uses a precise verb that directly matches the tool's name without being tautological.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit guidance on when to use 'force=true' (for running containers), which helps differentiate usage from simply stopping a container first. However, it doesn't mention alternatives like using 'stop_container' before removal or when not to use this tool, leaving some context gaps compared to siblings.

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

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