debugpy_list_containers
List Docker containers with running Python processes to attach debugpy for debugging and inspection.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Output Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/debugpy_mcp/server.py:428-430 (handler)The tool handler function decorated with @mcp.tool() that implements the debugpy_list_containers tool. It calls the helper function list_containers() and returns the results as a dictionary with container information.
@mcp.tool() def debugpy_list_containers() -> dict[str, Any]: return {"ok": True, "containers": [c.model_dump() for c in list_containers()]} - src/debugpy_mcp/server.py:143-153 (helper)Helper function that executes 'docker ps' command and parses the output to return a list of ContainerSummary objects containing container ID, name, image, status, and ports information.
def list_containers() -> list[ContainerSummary]: proc = run([ "docker", "ps", "--format", "{{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}" ], timeout=10) items: list[ContainerSummary] = [] for line in proc.stdout.splitlines(): parts = line.split("\t") if len(parts) != 5: continue items.append(ContainerSummary(id=parts[0], name=parts[1], image=parts[2], status=parts[3], ports=parts[4])) return items - src/debugpy_mcp/server.py:16-21 (schema)Pydantic BaseModel schema that defines the structure of container summary data with fields: id, name, image, status, and ports (all strings).
class ContainerSummary(BaseModel): id: str name: str image: str status: str ports: str