Skip to main content
Glama

gitlab_get_job_logs

Retrieve job execution logs from GitLab CI/CD pipelines to monitor build status and debug failures.

Instructions

Gets logs for a specific job.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
projectPathYesThe path of the GitLab project.
jobIdYesThe ID of the job.

Implementation Reference

  • Implements the core logic for fetching GitLab CI/CD job logs by making a direct API request to the /jobs/{jobId}/trace endpoint and returning the log text.
    async getJobLogs(projectPath: string, jobId: number): Promise<string> {
      const encodedProjectPath = encodeURIComponent(projectPath);
      const url = `${this.config.url}/api/v4/projects/${encodedProjectPath}/jobs/${jobId}/trace`;
      const headers = {
        'Private-Token': this.config.accessToken,
      };
    
      try {
        const response = await fetch(url, { headers });
        if (!response.ok) {
          throw new Error(`Failed to get job logs: ${response.status} - ${response.statusText}`);
        }
        return await response.text();
      } catch (error) {
        console.error(`Failed to get job logs: ${error}`);
        throw error;
      }
    }
  • Defines the tool schema including input parameters: projectPath (string) and jobId (number).
    name: 'gitlab_get_job_logs',
    description: 'Gets logs for a specific job.',
    inputSchema: {
      type: 'object',
      properties: {
        projectPath: {
          type: 'string',
          description: 'The path of the GitLab project.',
        },
        jobId: {
          type: 'number',
          description: 'The ID of the job.',
        },
      },
      required: ['projectPath', 'jobId'],
    },
  • src/index.ts:1824-1838 (registration)
    Registers the tool handler in the MCP server switch statement, dispatching to GitLabService.getJobLogs and returning the logs as text content.
    case 'gitlab_get_job_logs': {
      if (!gitlabService) {
        throw new Error('GitLab service is not initialized.');
      }
      const { projectPath, jobId } = args as { projectPath: string; jobId: number };
      const result = await gitlabService.getJobLogs(projectPath, jobId);
      return {
        content: [
          {
            type: 'text',
            text: result,
          },
        ],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states a read operation ('Gets'), implying it's non-destructive, but doesn't cover critical aspects like authentication requirements, rate limits, error conditions (e.g., invalid job ID), or output format (e.g., raw logs vs. structured data). For a tool with zero annotation coverage, this is insufficient.

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

Conciseness5/5

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

The description is a single, efficient sentence with zero waste. It's front-loaded with the core purpose and avoids unnecessary elaboration, making it easy to parse quickly.

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

Completeness2/5

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

Given the lack of annotations and output schema, the description is incomplete. It doesn't address behavioral traits (e.g., authentication), usage context, or return values. For a tool that fetches operational data like logs, more context is needed to guide the agent effectively.

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

Parameters3/5

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

Schema description coverage is 100%, with both parameters ('projectPath' and 'jobId') clearly documented in the schema. The description doesn't add any meaning beyond what the schema provides (e.g., format examples or relationship between parameters). Baseline 3 is appropriate when the schema does the heavy lifting.

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

Purpose4/5

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

The description clearly states the verb ('Gets') and resource ('logs for a specific job'), making the purpose immediately understandable. However, it doesn't differentiate from potential sibling tools like 'gitlab_get_pipeline_jobs' or 'gitlab_get_pipeline_details' that might also provide job-related information, preventing a perfect score.

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. The description doesn't mention prerequisites (e.g., needing a valid job ID from another tool), context (e.g., after a pipeline run), or exclusions (e.g., not for archived jobs). This leaves the agent to infer usage from the tool name alone.

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/HainanZhao/mcp-gitlab-jira'

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