Skip to main content
Glama

list_images

Lists Docker images available on the host system for container management and deployment.

Instructions

List Docker images on the host.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The handler function that executes the list_images tool logic. It calls docker.listImages() to fetch Docker images and maps the results to ImageInfo objects with formatted id, tags, size, and created date.
    export async function listImages(): Promise<ImageInfo[]> {
      const images = await docker.listImages();
      return images.map((img) => ({
        id: img.Id.replace("sha256:", "").slice(0, 12),
        tags: img.RepoTags ?? ["<none>"],
        size: formatBytes(img.Size),
        created: new Date(img.Created * 1000).toISOString(),
      }));
    }
  • Type definition for the image data returned by the list_images tool, defining the structure of ImageInfo with id, tags, size, and created fields.
    export interface ImageInfo {
      id: string;
      tags: string[];
      size: string;
      created: string;
    }
  • src/index.ts:155-173 (registration)
    Registration of the list_images tool with the MCP server. The tool takes no parameters (empty schema {}) and returns a formatted text output of all Docker images.
    server.tool("list_images", "List Docker images on the host.", {}, async () => {
      const images = await listImages();
      return {
        content: [
          {
            type: "text",
            text:
              images.length === 0
                ? "No images found."
                : images
                    .map(
                      (img) =>
                        `${img.id}  ${img.tags.join(", ").padEnd(40)}  ${img.size.padEnd(10)}  ${img.created}`,
                    )
                    .join("\n"),
          },
        ],
      };
    });
  • Helper utility function used by listImages to convert raw byte values into human-readable format (B, KB, MB, GB).
    function formatBytes(bytes: number): string {
      if (bytes === 0) return "0 B";
      const k = 1024;
      const sizes = ["B", "KB", "MB", "GB"];
      const i = Math.floor(Math.log(bytes) / Math.log(k));
      return `${(bytes / Math.pow(k, i)).toFixed(1)} ${sizes[i]}`;
    }
Behavior2/5

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

With no annotations provided, the description carries full burden but offers minimal behavioral insight. It states what the tool does but doesn't disclose traits like whether it's read-only, how results are formatted (e.g., list vs. detailed view), potential errors, or performance considerations. This leaves gaps for safe and effective use.

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 a single, direct sentence with no wasted words, making it highly concise and front-loaded. It immediately conveys the core functionality without unnecessary elaboration, which is ideal for a simple tool like this.

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 simplicity (0 parameters, no output schema, no annotations), the description is minimally adequate but lacks depth. It states the purpose but omits behavioral context (e.g., output format, error handling) that would help an agent use it correctly. For a read operation with no structured guidance, more completeness would be beneficial.

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 tool has 0 parameters with 100% schema description coverage, so the schema already fully documents the lack of inputs. The description adds no parameter information, which is appropriate here—no compensation is needed. A baseline of 4 reflects that the description doesn't need to cover parameters for this zero-param tool.

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

Purpose4/5

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

The description clearly states the action ('List') and resource ('Docker images on the host'), making the purpose immediately understandable. It distinguishes from siblings like 'list_containers' by specifying images rather than containers, though it doesn't explicitly contrast them. The description avoids tautology by not just restating the tool name.

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. While the description implies it's for listing images, it doesn't specify scenarios where this is preferred over other tools or mention prerequisites like Docker being installed. The agent must infer usage from the tool name and sibling context alone.

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