Skip to main content
Glama

list_pipeline_jobs

Retrieve all jobs from a specific GitLab CI/CD pipeline to monitor execution status and troubleshoot build processes.

Instructions

列出 Pipeline 的所有 Jobs

Args: project_id: 專案 ID 或路徑 pipeline_id: Pipeline ID page: 頁碼 per_page: 每頁筆數

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
pipeline_idYes
pageNo
per_pageNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The GitLabClient method that performs the actual API call to list pipeline jobs.
    def list_pipeline_jobs(
        self,
        project_id: int | str,
        pipeline_id: int,
        page: int = 1,
        per_page: int = 20,
    ) -> list[dict]:
        """GET /projects/:id/pipelines/:pipeline_id/jobs"""
        pid = self._resolve_project_id(project_id)
        params = {"page": page, "per_page": per_page}
        return self._get_json(
            f"/projects/{pid}/pipelines/{pipeline_id}/jobs", params=params
        )
  • The tool handler registered with the MCP server, which processes input and invokes the GitLabClient.
    @mcp.tool()
    def list_pipeline_jobs(project_id: int | str, pipeline_id: int,
                           page: int = 1, per_page: int = 20) -> str:
        """列出 Pipeline 的所有 Jobs
    
        Args:
            project_id: 專案 ID 或路徑
            pipeline_id: Pipeline ID
            page: 頁碼
            per_page: 每頁筆數
        """
        try:
            client = get_client()
            jobs = client.list_pipeline_jobs(project_id, pipeline_id, page=page, per_page=per_page)
    
            if not jobs:
                return "此 Pipeline 沒有 Jobs"
    
            status_emoji = {
                "success": "✅", "failed": "❌", "running": "🔄",
                "pending": "⏳", "canceled": "⛔", "skipped": "⏭️",
                "created": "🆕", "manual": "👋"
            }
            lines = [f"Pipeline #{pipeline_id} 的 Jobs(共 {len(jobs)} 個):\n"]
            for j in jobs:
                emoji = status_emoji.get(j.get("status", ""), "⚪")
                duration = f"{j['duration']:.1f}秒" if j.get("duration") else "N/A"
                lines.append(
                    f"{emoji} [{j.get('stage', 'N/A')}] {j['name']} (#{j['id']})"
                    f"\n  狀態: {j.get('status', 'N/A')} | 持續時間: {duration} | {j.get('web_url', '')}\n"
                )
            return "\n".join(lines)
        except GitLabAPIError as e:
            return f"列出 Jobs 失敗: {str(e)}"
    
    
    @mcp.tool()
    def get_job(project_id: int | str, job_id: int) -> str:
        """取得 Job 詳細資訊
    
        Args:
            project_id: 專案 ID 或路徑
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It mentions listing jobs but doesn't disclose behavioral traits like whether this is a read-only operation, if it requires authentication, rate limits, pagination behavior (implied by page/per_page but not explained), or what happens with invalid inputs. This leaves significant gaps for an agent to understand how to use it safely and effectively.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is appropriately sized and front-loaded, starting with the main purpose followed by parameter listings. However, the structure includes a redundant 'Args:' section that repeats parameter names without adding much value, slightly reducing efficiency. Overall, it's concise but could be more streamlined.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has 4 parameters with 0% schema coverage and an output schema exists (which handles return values), the description is partially complete. It covers the basic purpose and parameters but lacks behavioral context and usage guidelines. With no annotations, it should do more to explain how the tool behaves, but the output schema mitigates some gaps by defining return values.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, so the description must compensate. It lists parameters (project_id, pipeline_id, page, per_page) but adds minimal semantics: '專案 ID 或路徑' clarifies project_id can be an ID or path, which is helpful, but doesn't explain pipeline_id beyond 'Pipeline ID' or the pagination parameters. This partially addresses the coverage gap but leaves key details unclear, such as format expectations or default behaviors.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states '列出 Pipeline 的所有 Jobs' (List all jobs of a pipeline), which provides a clear verb ('list') and resource ('jobs of a pipeline'). However, it doesn't distinguish this tool from siblings like 'get_job' (which retrieves a single job) or 'list_pipelines' (which lists pipelines rather than jobs), leaving the purpose somewhat vague in context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives. For example, it doesn't mention using 'get_job' for details on a specific job or 'list_pipelines' to find pipelines first. The description only states what it does, with no context for selection among related tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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