Skip to main content
Glama
Alosies

GitLab MCP Server

by Alosies

get_job_logs

Retrieve the log file for a specific GitLab CI/CD job by providing the project ID and job ID to access execution details and troubleshooting information.

Instructions

Get the log (trace) file of a specific job

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
project_idYesProject ID or path
job_idYesJob ID

Implementation Reference

  • The core handler function that executes the get_job_logs tool by fetching the job trace (logs) from the GitLab API and returning it as text content.
    async getJobLogs(args: GetJobLogsParams) {
      const data = await this.client.get(`/projects/${encodeURIComponent(args.project_id)}/jobs/${args.job_id}/trace`);
      
      return {
        content: [
          {
            type: 'text',
            text: data,
          },
        ],
      };
    }
  • src/server.ts:321-324 (registration)
    Server dispatch registration that routes 'get_job_logs' tool calls to the JobHandlers.getJobLogs method.
    case "get_job_logs":
      return await this.jobHandlers.getJobLogs(
        args as unknown as GetJobLogsParams
      );
  • Tool definition including name, description, and input schema for validation, registered in allTools.
    {
      name: 'get_job_logs',
      description: 'Get the log (trace) file of a specific job',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'Project ID or path',
          },
          job_id: {
            type: 'number',
            description: 'Job ID',
          },
        },
        required: ['project_id', 'job_id'],
      },
    },
  • TypeScript interface defining the input parameters for the get_job_logs tool.
    export interface GetJobLogsParams {
      project_id: string;
      job_id: number;
    }
  • Tool object registration in jobTools array, which is included in the server's allTools list.
    {
      name: 'get_job_logs',
      description: 'Get the log (trace) file of a specific job',
      inputSchema: {
        type: 'object',
        properties: {
          project_id: {
            type: 'string',
            description: 'Project ID or path',
          },
          job_id: {
            type: 'number',
            description: 'Job ID',
          },
        },
        required: ['project_id', 'job_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/Alosies/gitlab-mcp-server'

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