Skip to main content
Glama

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
NameRequiredDescriptionDefault
project_idYes
pipeline_idYes

Implementation Reference

  • 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)}"
  • 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}")

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/snowild/gitlab-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server