Skip to main content
Glama

image_prune_builds

DestructiveIdempotent

Delete Docker's build cache to reclaim disk space after builds. Use when storage is tight; removed cache is rebuilt on demand.

Instructions

Delete the daemon's build cache to reclaim disk space.

Prunes the build cache - a separate Engine resource from the images image_prune removes, so run both to reclaim everything a build leaves behind. Prefer buildx_prune when the build ran on a non-default buildx builder (that builder keeps its own cache, invisible here) or when you need any disk ceiling at all - reserved_space, max_used_space or min_free_space, none of which the docker-py path can send; this tool needs no CLI plugin and works over any transport, including a daemon with no local docker binary. Inventory first with system_df (its BuildCache entry) or buildx_du. Destructive and immediate: later builds must re-run the steps whose cache was removed. Needs Docker API v1.31+; passing either filters or all needs v1.39+ and raises InvalidVersion on an older daemon - omit both to prune with the daemon's own defaults.

Args: filters: Narrow which cache records to remove, e.g. {"until": "24h"} (a duration or timestamp relative to the daemon's clock); also accepts id, parent, type, description, inuse, shared, private; omit to let the daemon prune unused cache all: Remove all types of build cache, not just the unused records

Returns: dict: {"CachesDeleted": [...], "SpaceReclaimed": }

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
allNo
filtersNo

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changedv2.2.6
    • removedInput schema / properties / keep_storage
      Removed value: -{
      -  "default": null,
      -  "type": "integer"
      -}
  2. Added

TDQS

A4.7/5.0
Behavior4/5

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

Annotations already include destructiveHint=true and idempotentHint=true. The description reinforces destructive behavior ('Destructive and immediate: later builds must re-run the steps whose cache was removed') and adds critical version constraints (Docker API v1.31+, v1.39+ for filters/all) and the consequence of omitting arguments. It does not explicitly address idempotency, but the annotation covers that; the added context is valuable and non-contradictory.

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 long but tightly organized: a clear purpose statement, then a section on when to use alternatives, then parameter and return details. Every sentence earns its place; the front-loaded purpose is immediately clear. The length is justified by the complexity of the tool (API versions, comparisons, parameter semantics). Slightly verbose but not wasteful.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a destructive, version-sensitive tool with nuanced parameter behavior, the description covers all essentials: API version requirements, error on old daemons, the distinction from sibling tools, return format, and the implications of omitting arguments. An agent can invoke it correctly without external documentation.

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

Parameters5/5

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

Schema coverage is 0%, so the description must fully explain the parameters. It does: the Args section details filters (with example {'until': '24h'}, accepted keys like id, parent, type, description, inuse, shared, private, and the behavior when omitted) and all (removes all types of build cache). This far exceeds the schema's bare types and adds critical semantic meaning.

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 opens with 'Delete the daemon's build cache to reclaim disk space', a specific verb-resource pair that clearly states the action and target. It further distinguishes itself from sibling image_prune (removes images) and buildx_prune (for non-default builders), leaving no ambiguity about what this tool does versus its alternatives.

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

Usage Guidelines5/5

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

The description explicitly advises when to prefer buildx_prune (non-default builder, disk ceiling needs) and when to use this tool (no CLI plugin, any transport, no local docker binary). It also recommends running both image_prune and this tool for full cleanup, and suggests inventorying with system_df or buildx_du. This gives clear, actionable guidance on tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Deploy Server

Other Tools