get_pipeline
Retrieve detailed information about a specific CI/CD pipeline from a GitLab project using project and pipeline identifiers.
Instructions
取得 Pipeline 詳細資訊
Args: project_id: 專案 ID 或路徑 pipeline_id: Pipeline ID
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| project_id | Yes | ||
| pipeline_id | Yes |
Implementation Reference
- src/gitlab_mcp/server.py:546-576 (handler)The MCP tool handler for 'get_pipeline' which fetches pipeline details and formats them as a string.
@mcp.tool() def get_pipeline(project_id: int | str, pipeline_id: int) -> str: """取得 Pipeline 詳細資訊 Args: project_id: 專案 ID 或路徑 pipeline_id: Pipeline ID """ try: client = get_client() p = client.get_pipeline(project_id, pipeline_id) status_emoji = { "success": "✅", "failed": "❌", "running": "🔄", "pending": "⏳", "canceled": "⛔", "skipped": "⏭️" } emoji = status_emoji.get(p.get("status", ""), "⚪") return f"""{emoji} Pipeline #{p['id']} 狀態: {p.get('status', 'N/A')} Ref: {p.get('ref', 'N/A')} SHA: {p.get('sha', 'N/A')} 建立時間: {p.get('created_at', 'N/A')} 更新時間: {p.get('updated_at', 'N/A')} 開始時間: {p.get('started_at', 'N/A')} 完成時間: {p.get('finished_at', 'N/A')} 持續時間: {p.get('duration', 'N/A')}秒 網址: {p.get('web_url', '')}""" except GitLabAPIError as e: return f"取得 Pipeline 失敗: {str(e)}" - src/gitlab_mcp/gitlab_client.py:314-317 (handler)The underlying GitLab API client method used by the MCP tool to retrieve pipeline information.
def get_pipeline(self, project_id: int | str, pipeline_id: int) -> dict: """GET /projects/:id/pipelines/:pipeline_id""" pid = self._resolve_project_id(project_id) return self._get_json(f"/projects/{pid}/pipelines/{pipeline_id}")