docker_compose_ps
List running containers in a Docker Compose stack to monitor service status and manage your development environment effectively.
Instructions
List containers in a docker-compose stack
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| services | No | Only show specific services | |
| all | No | Show all stopped containers | |
| file | No | Path to compose file | |
| cwd | No | Working directory |
Implementation Reference
- src/tools/docker.ts:321-331 (handler)The main handler function that executes the docker compose ps command using the shared executeDockerCommand helper. Detects docker-compose vs docker compose V2.export async function dockerComposePs(args: z.infer<typeof dockerComposePsSchema>): Promise<ToolResponse> { const allFlag = args.all ? '-a' : ''; const services = args.services ? args.services.join(' ') : ''; const fileFlag = args.file ? `-f ${args.file}` : ''; const composeCmd = await getComposeCmd(); return executeDockerCommand( `${composeCmd} ${fileFlag} ps ${allFlag} ${services}`.trim(), args.cwd ); }
- src/tools/docker.ts:175-180 (schema)Zod schema for input validation of docker_compose_ps tool parameters.export const dockerComposePsSchema = z.object({ services: z.array(z.string()).optional().describe('Only show specific services'), all: z.boolean().optional().default(false).describe('Show all stopped containers'), file: z.string().optional().describe('Path to compose file'), cwd: z.string().optional().describe('Working directory') });
- src/index.ts:491-494 (registration)Dispatch handler in main MCP server that routes calls to docker_compose_ps by name, validates args, and invokes the handler.if (name === 'docker_compose_ps') { const validated = dockerComposePsSchema.parse(args); return await dockerComposePs(validated); }
- src/tools/docker.ts:549-561 (registration)Tool definition object in dockerTools array used for listing available tools in MCP server.{ name: 'docker_compose_ps', description: 'List containers in a docker-compose stack', inputSchema: { type: 'object', properties: { services: { type: 'array', items: { type: 'string' }, description: 'Only show specific services' }, all: { type: 'boolean', default: false, description: 'Show all stopped containers' }, file: { type: 'string', description: 'Path to compose file' }, cwd: { type: 'string', description: 'Working directory' } } } },