list_images
View all Docker images available on your system to manage containers and resources through the Docker MCP Server.
Instructions
List all Docker images
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "list_images"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:238-256 (handler)The main handler function that executes the 'docker images' command, parses the output into a list of image objects (name, id, size), and returns it as JSON-formatted text content.
private async listImages() { const { stdout } = await execAsync('docker images --format "{{.Repository}}:{{.Tag}}\\t{{.ID}}\\t{{.Size}}"'); const images = stdout.trim().split('\n') .filter(line => line.trim() !== '') .map(line => { const [name, id, size] = line.split('\t'); return { name, id, size }; }); return { content: [ { type: 'text', text: JSON.stringify(images, null, 2), }, ], }; } - src/index.ts:82-89 (registration)Registration of the 'list_images' tool in the ListToolsRequestSchema handler, specifying name, description, and empty input schema (no parameters required).
{ name: 'list_images', description: 'List all Docker images', inputSchema: { type: 'object', properties: {}, }, }, - src/index.ts:85-88 (schema)Input schema definition for the list_images tool: an empty object, indicating no input parameters are required.
inputSchema: { type: 'object', properties: {}, }, - src/index.ts:191-192 (helper)Switch case in the CallToolRequestSchema handler that dispatches to the listImages method when 'list_images' tool is called.
case 'list_images': return await this.listImages();