docker_images
List Docker images with filtering options to manage container environments and identify available images for development workflows.
Instructions
List Docker images
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| filter | No | Filter images (e.g., "reference=node:*") | |
| all | No | Show all images (default hides intermediate) | |
| format | No | Output format | table |
| cwd | No | Working directory |
Implementation Reference
- src/tools/docker.ts:281-289 (handler)The main handler function that constructs and executes the 'docker images' command using the shared executeDockerCommand helper, based on input arguments.export async function dockerImages(args: z.infer<typeof dockerImagesSchema>): Promise<ToolResponse> { const allFlag = args.all ? '-a' : ''; const filterFlag = args.filter ? `--filter "${args.filter}"` : ''; const formatFlag = args.format === 'json' ? '--format "{{json .}}"' : '--format "table {{.Repository}}\\t{{.Tag}}\\t{{.ID}}\\t{{.Size}}"'; return executeDockerCommand(`docker images ${allFlag} ${filterFlag} ${formatFlag}`.trim(), args.cwd); }
- src/tools/docker.ts:147-152 (schema)Zod schema for validating input arguments to the docker_images tool.export const dockerImagesSchema = z.object({ filter: z.string().optional().describe('Filter images (e.g., "reference=node:*")'), all: z.boolean().optional().default(false).describe('Show all images (default hides intermediate)'), format: z.enum(['table', 'json']).optional().default('table').describe('Output format'), cwd: z.string().optional().describe('Working directory') });
- src/tools/docker.ts:496-508 (registration)MCP tool metadata definition for 'docker_images' included in the exported dockerTools array used for tool listing.{ name: 'docker_images', description: 'List Docker images', inputSchema: { type: 'object', properties: { filter: { type: 'string', description: 'Filter images (e.g., "reference=node:*")' }, all: { type: 'boolean', default: false, description: 'Show all images (default hides intermediate)' }, format: { type: 'string', enum: ['table', 'json'], default: 'table', description: 'Output format' }, cwd: { type: 'string', description: 'Working directory' } } } },
- src/index.ts:475-478 (registration)Dispatch logic in the main MCP CallToolRequest handler that routes calls to docker_images by validating arguments and invoking the handler function.if (name === 'docker_images') { const validated = dockerImagesSchema.parse(args); return await dockerImages(validated); }