orbstack_docker_ps
List Docker containers running on macOS via OrbStack. Shows active containers by default, with an option to display all containers including stopped ones.
Instructions
列出 Docker 容器。
默认只显示运行中的容器,设置 all=True 显示全部。
Args: params: 包含是否显示所有容器的选项
Returns: str: 容器列表(格式化表格)
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| params | Yes |
Implementation Reference
- src/orbstack_mcp/server.py:656-676 (handler)The handler function for the 'orbstack_docker_ps' tool, which executes 'docker ps' via '_run_docker'.
async def orbstack_docker_ps(params: DockerPsInput) -> str: """列出 Docker 容器。 默认只显示运行中的容器,设置 all=True 显示全部。 Args: params: 包含是否显示所有容器的选项 Returns: str: 容器列表(格式化表格) """ args = ["ps", "--format", "table {{.ID}}\t{{.Names}}\t{{.Image}}\t{{.Status}}\t{{.Ports}}"] if params.all: args.append("-a") code, stdout, stderr = await _run_docker(args) if code != 0: return _format_error(stderr, "请确认 OrbStack 正在运行: orbstack_start") if not stdout or stdout.count("\n") == 0: return "当前没有运行中的容器。" + (" 使用 --all 查看所有容器。" if not params.all else "") return f"Docker 容器:\n{stdout}" - src/orbstack_mcp/server.py:646-654 (registration)The tool registration for 'orbstack_docker_ps' using the '@mcp.tool' decorator.
@mcp.tool( name="orbstack_docker_ps", annotations={ "title": "列出 Docker 容器", "readOnlyHint": True, "destructiveHint": False, "idempotentHint": True, "openWorldHint": False, }, - src/orbstack_mcp/server.py:163-167 (schema)The Pydantic model 'DockerPsInput' defining the input schema for the tool.
class DockerPsInput(BaseModel): """列出 Docker 容器的输入参数""" model_config = ConfigDict(extra="forbid") all: bool = Field(