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
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Container ID or name | |
| force | No | Force remove running container |
Implementation Reference
- src/docker.ts:91-98 (handler)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 }] }; }, ); - src/index.ts:103-110 (schema)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"), },