list_pipeline_jobs
Retrieve and filter jobs from a specific GitLab pipeline to monitor execution status, track progress, and identify failed or pending tasks.
Instructions
List jobs in a pipeline
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| include_retried | No | Include retried jobs | |
| pipeline_id | Yes | Pipeline ID | |
| project_id | Yes | Project ID or path | |
| scope | No | Filter jobs by status |
Implementation Reference
- src/handlers/jobs.ts:11-29 (handler)The main handler function that implements the logic for the 'list_pipeline_jobs' tool. It constructs query parameters based on input, fetches job data from the GitLab API, and returns the JSON-formatted response.async listPipelineJobs(args: ListPipelineJobsParams) { const params = new URLSearchParams(); if (args.scope && args.scope.length > 0) { args.scope.forEach((status: string) => params.append('scope[]', status)); } if (args.include_retried !== undefined) params.append('include_retried', String(args.include_retried)); const data = await this.client.get(`/projects/${encodeURIComponent(args.project_id)}/pipelines/${args.pipeline_id}/jobs?${params.toString()}`); return { content: [ { type: 'text', text: JSON.stringify(data, null, 2), }, ], }; }
- src/tools/jobs.ts:4-34 (registration)Registers the 'list_pipeline_jobs' tool in the MCP SDK tool list, providing name, description, and input schema for validation.{ name: 'list_pipeline_jobs', description: 'List jobs in a pipeline', inputSchema: { type: 'object', properties: { project_id: { type: 'string', description: 'Project ID or path', }, pipeline_id: { type: 'number', description: 'Pipeline ID', }, scope: { type: 'array', items: { type: 'string', enum: ['created', 'pending', 'running', 'failed', 'success', 'canceled', 'skipped', 'waiting_for_resource', 'manual'], }, description: 'Filter jobs by status', }, include_retried: { type: 'boolean', description: 'Include retried jobs', default: false, }, }, required: ['project_id', 'pipeline_id'], }, },
- src/types.ts:382-387 (schema)TypeScript interface defining the input parameters for the list_pipeline_jobs handler.export interface ListPipelineJobsParams { project_id: string; pipeline_id: number; scope?: GitLabJob['status'][]; include_retried?: boolean; }
- src/server.ts:317-320 (registration)Server-side dispatch that routes 'list_pipeline_jobs' tool calls to the corresponding handler method.case "list_pipeline_jobs": return await this.jobHandlers.listPipelineJobs( args as unknown as ListPipelineJobsParams );
- src/tools/jobs.ts:7-33 (schema)JSON schema for input validation of the 'list_pipeline_jobs' tool used by MCP SDK.inputSchema: { type: 'object', properties: { project_id: { type: 'string', description: 'Project ID or path', }, pipeline_id: { type: 'number', description: 'Pipeline ID', }, scope: { type: 'array', items: { type: 'string', enum: ['created', 'pending', 'running', 'failed', 'success', 'canceled', 'skipped', 'waiting_for_resource', 'manual'], }, description: 'Filter jobs by status', }, include_retried: { type: 'boolean', description: 'Include retried jobs', default: false, }, }, required: ['project_id', 'pipeline_id'], },