jenkins_get_build_steps
Retrieve the status of steps for a specific Jenkins build to monitor CI/CD pipeline execution progress and identify issues in application deployments.
Instructions
Obtener el estado de los steps de un build específico
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app | Yes | Nombre de la aplicación | |
| buildNumber | Yes | Número del build | |
| branch | No | Rama de Git (por defecto: main) |
Implementation Reference
- index.ts:128-151 (handler)MCP tool handler function for 'jenkins_get_build_steps': invokes JenkinsService.getJobStepsStatus, formats the build steps and stages into a markdown text response.async (args) => { try { const result = await getJenkinsService().getJobStepsStatus(args.app, args.buildNumber, args.branch || 'main'); const stepsText = `📋 **Steps del Build #${args.buildNumber} - ${args.app}**\n\n` + `**ID:** ${result.id}\n` + `**Nombre:** ${result.name}\n` + `**Estado:** ${result.status}\n` + `**Duración:** ${formatDuration(result.durationMillis)}\n` + `**Inicio:** ${formatTimestamp(result.startTimeMillis)}\n\n` + `**Stages (${result.stages.length}):**\n` + result.stages.map(stage => `- **${stage.name}** (${stage.status}) - ${formatDuration(stage.durationMillis)}` ).join('\n'); return { content: [{ type: "text", text: stepsText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } }
- index.ts:123-127 (schema)Input schema for the tool using Zod validation: app (required string), buildNumber (required number), branch (optional string).{ app: z.string().describe("Nombre de la aplicación"), buildNumber: z.number().describe("Número del build"), branch: z.string().optional().describe("Rama de Git (por defecto: main)") },
- index.ts:120-152 (registration)Registration of the 'jenkins_get_build_steps' tool with the MCP server, including name, description, input schema, and handler.server.tool( "jenkins_get_build_steps", "Obtener el estado de los steps de un build específico", { app: z.string().describe("Nombre de la aplicación"), buildNumber: z.number().describe("Número del build"), branch: z.string().optional().describe("Rama de Git (por defecto: main)") }, async (args) => { try { const result = await getJenkinsService().getJobStepsStatus(args.app, args.buildNumber, args.branch || 'main'); const stepsText = `📋 **Steps del Build #${args.buildNumber} - ${args.app}**\n\n` + `**ID:** ${result.id}\n` + `**Nombre:** ${result.name}\n` + `**Estado:** ${result.status}\n` + `**Duración:** ${formatDuration(result.durationMillis)}\n` + `**Inicio:** ${formatTimestamp(result.startTimeMillis)}\n\n` + `**Stages (${result.stages.length}):**\n` + result.stages.map(stage => `- **${stage.name}** (${stage.status}) - ${formatDuration(stage.durationMillis)}` ).join('\n'); return { content: [{ type: "text", text: stepsText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } } );
- tools/jenkins-service.ts:112-128 (helper)Core helper method in JenkinsService that performs the HTTP request to Jenkins /wfapi/describe endpoint to retrieve the build steps status (BuildSteps type).async getJobStepsStatus(app: string, buildNumber: number, branch: string = 'main'): Promise<BuildSteps> { if (!validateAppName(app)) { throw new Error('Invalid app name.'); } const stepsUrl = `${buildJobBuildUrl('', app, buildNumber, branch)}/wfapi/describe`; try { const response: AxiosResponse<BuildSteps> = await this.client.get(stepsUrl); return response.data; } catch (error: any) { if (error.response?.status === 404) { throw new JenkinsError(`Build steps not found for app: ${app}, build: ${buildNumber}, branch: ${branch}`); } throw handleHttpError(error, `Failed to get job steps for app: ${app}, build: ${buildNumber}, branch: ${branch}`); } }