Skip to main content
Glama

get_job

Retrieve detailed information about a specific CI/CD job in GitLab by providing the project identifier and job ID.

Instructions

取得 Job 詳細資訊

Args: project_id: 專案 ID 或路徑 job_id: Job ID

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYes
job_idYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for "get_job". It wraps the gitlab_client's get_job method and formats the result.
    def get_job(project_id: int | str, job_id: int) -> str:
        """取得 Job 詳細資訊
    
        Args:
            project_id: 專案 ID 或路徑
            job_id: Job ID
        """
        try:
            client = get_client()
            j = client.get_job(project_id, job_id)
    
            status_emoji = {
                "success": "✅", "failed": "❌", "running": "🔄",
                "pending": "⏳", "canceled": "⛔", "skipped": "⏭️"
            }
            emoji = status_emoji.get(j.get("status", ""), "⚪")
            duration = f"{j['duration']:.1f}秒" if j.get("duration") else "N/A"
    
            return f"""{emoji} Job #{j['id']} — {j.get('name', 'N/A')}
    階段: {j.get('stage', 'N/A')}
    狀態: {j.get('status', 'N/A')}
    持續時間: {duration}
    Ref: {j.get('ref', 'N/A')}
    Runner: {j.get('runner', {}).get('description', 'N/A') if j.get('runner') else 'N/A'}
    建立時間: {j.get('created_at', 'N/A')}
    開始時間: {j.get('started_at', 'N/A')}
    完成時間: {j.get('finished_at', 'N/A')}
    網址: {j.get('web_url', '')}
    
    💡 使用 get_job_log({j['id']}) 查看執行日誌"""
        except GitLabAPIError as e:
            return f"取得 Job 失敗: {str(e)}"
  • The underlying gitlab client method that makes the API request to fetch job details.
    def get_job(self, project_id: int | str, job_id: int) -> dict:
        """GET /projects/:id/jobs/:job_id"""
        pid = self._resolve_project_id(project_id)
        return self._get_json(f"/projects/{pid}/jobs/{job_id}")
  • Registration of the get_job tool using @mcp.tool().
    @mcp.tool()
    def get_job(project_id: int | str, job_id: int) -> str:
Behavior2/5

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

No annotations are provided, so the description carries full burden for behavioral disclosure. The description only states it retrieves job details without mentioning whether this is a read-only operation, what permissions are required, whether it returns real-time or cached data, or how it handles errors. For a tool with no annotation coverage, this leaves significant behavioral gaps.

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 concise with a clear purpose statement followed by parameter documentation. The bilingual format (Chinese purpose, English parameter labels) is slightly inconsistent but doesn't significantly impact readability. The structure is front-loaded with the main purpose first.

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 that an output schema exists, the description doesn't need to explain return values. However, for a tool with 2 required parameters, 0% schema description coverage, and no annotations, the description provides only basic purpose and parameter listing without addressing usage context, behavioral characteristics, or parameter details. It's minimally adequate but leaves significant gaps.

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 schema provides no parameter documentation. The description adds minimal parameter semantics by listing 'project_id: 專案 ID 或路徑' and 'job_id: Job ID' but doesn't explain format expectations, where to find these IDs, or what constitutes valid values. This doesn't adequately compensate for the complete lack of schema documentation.

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 '取得 Job 詳細資訊' (Get job details) which provides a clear verb+resource combination. However, it doesn't differentiate from sibling tools like 'get_job_log' or 'get_pipeline' that also retrieve job-related information. The purpose is understandable but lacks specificity about what kind of job details are retrieved.

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 about when to use this tool versus alternatives. With siblings like 'get_job_log' (for logs), 'get_pipeline' (for pipeline context), and 'retry_job' (for job control), the description offers no indication of when this specific job details retrieval tool is appropriate versus other job-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