gitlab_get_pipeline_details
Retrieve detailed pipeline information from GitLab projects to monitor CI/CD status and troubleshoot build processes.
Instructions
Gets detailed information about a specific pipeline.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectPath | Yes | The path of the GitLab project. | |
| pipelineId | Yes | The ID of the pipeline. |
Implementation Reference
- src/gitlab.service.ts:539-544 (handler)Core handler implementation: GitLabService.getPipelineDetails fetches the pipeline details by calling the GitLab API endpoint for the specific project and pipeline ID.async getPipelineDetails(projectPath: string, pipelineId: number): Promise<any> { const encodedProjectPath = encodeURIComponent(projectPath); return this.callGitLabApi<any>( `projects/${encodedProjectPath}/pipelines/${pipelineId}`, ); }
- src/index.ts:643-658 (registration)Tool registration: Defines the 'gitlab_get_pipeline_details' tool including its name, description, and input schema in the allTools array used by the MCP server.name: 'gitlab_get_pipeline_details', description: 'Gets detailed information about a specific pipeline.', inputSchema: { type: 'object', properties: { projectPath: { type: 'string', description: 'The path of the GitLab project.', }, pipelineId: { type: 'number', description: 'The ID of the pipeline.', }, }, required: ['projectPath', 'pipelineId'], },
- src/index.ts:1792-1806 (handler)MCP tool call handler: The switch case in the CallToolRequestSchema handler that extracts arguments, calls GitLabService.getPipelineDetails, and formats the response as MCP content.case 'gitlab_get_pipeline_details': { if (!gitlabService) { throw new Error('GitLab service is not initialized.'); } const { projectPath, pipelineId } = args as { projectPath: string; pipelineId: number }; const result = await gitlabService.getPipelineDetails(projectPath, pipelineId); return { content: [ { type: 'text', text: JSON.stringify(result, null, 2), }, ], }; }
- src/gitlab.service.ts:22-51 (helper)Helper method: callGitLabApi is the private utility used by getPipelineDetails to make authenticated HTTP requests to the GitLab API.private async callGitLabApi<T>( endpoint: string, method: string = 'GET', body?: object, ): Promise<T> { const url = `${this.config.url}/api/v4/${endpoint}`; const headers = { 'Private-Token': this.config.accessToken, 'Content-Type': 'application/json', }; const options: any = { method, headers, body: body ? JSON.stringify(body) : undefined, }; try { const response = await fetch(url, options); if (!response.ok) { const errorText = await response.text(); console.error(`GitLab API Error: ${response.status} - ${errorText}`); throw new Error(`GitLab API Error: ${response.status} - ${errorText}`); } return response.json() as Promise<T>; } catch (error) { console.error(`Failed to call GitLab API: ${error}`); throw error; } }