list_pipelines
Retrieve CI/CD pipeline data from GitLab projects using filters for status, branch, and pagination to monitor deployment workflows.
Instructions
列出專案的 CI/CD Pipelines
Args: project_id: 專案 ID 或路徑 status: 狀態篩選(running, pending, success, failed, canceled, skipped) ref: 分支或標籤名稱篩選 page: 頁碼 per_page: 每頁筆數
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| status | No | ||
| ref | No | ||
| page | No | ||
| per_page | No |
Implementation Reference
- src/gitlab_mcp/gitlab_client.py:297-312 (handler)The actual implementation of the list_pipelines method, which interacts with the GitLab API.
def list_pipelines( self, project_id: int | str, status: str = None, ref: str = None, page: int = 1, per_page: int = 20, ) -> list[dict]: """GET /projects/:id/pipelines""" pid = self._resolve_project_id(project_id) params = {"page": page, "per_page": per_page} if status: params["status"] = status if ref: params["ref"] = ref return self._get_json(f"/projects/{pid}/pipelines", params=params) - src/gitlab_mcp/server.py:505-535 (registration)The MCP tool registration and wrapper function for list_pipelines.
@mcp.tool() def list_pipelines(project_id: int | str, status: str = None, ref: str = None, page: int = 1, per_page: int = 20) -> str: """列出專案的 CI/CD Pipelines Args: project_id: 專案 ID 或路徑 status: 狀態篩選(running, pending, success, failed, canceled, skipped) ref: 分支或標籤名稱篩選 page: 頁碼 per_page: 每頁筆數 """ try: if status: v = GitLabValidator.validate_pipeline_status(status) if not v.is_valid: return "\n".join(v.errors) client = get_client() pipelines = client.list_pipelines(project_id, status=status, ref=ref, page=page, per_page=per_page) if not pipelines: return "找不到符合條件的 Pipeline" status_emoji = { "success": "✅", "failed": "❌", "running": "🔄", "pending": "⏳", "canceled": "⛔", "skipped": "⏭️", "created": "🆕", "manual": "👋" } lines = [f"找到 {len(pipelines)} 個 Pipeline:\n"] for p in pipelines: