jenkins_get_build_steps
Retrieve detailed status of steps for a specific build in Jenkins CI/CD pipelines by specifying the application and build number, facilitating precise pipeline monitoring and troubleshooting.
Instructions
Obtener el estado de los steps de un build específico
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app | Yes | Nombre de la aplicación | |
| branch | No | Rama de Git (por defecto: main) | |
| buildNumber | Yes | Número del build |
Input Schema (JSON Schema)
{
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"properties": {
"app": {
"description": "Nombre de la aplicación",
"type": "string"
},
"branch": {
"description": "Rama de Git (por defecto: main)",
"type": "string"
},
"buildNumber": {
"description": "Número del build",
"type": "number"
}
},
"required": [
"app",
"buildNumber"
],
"type": "object"
}
Implementation Reference
- index.ts:121-152 (registration)Registration of the jenkins_get_build_steps MCP tool, including input schema (app, buildNumber, optional branch) and inline handler that fetches data via JenkinsService and formats response as formatted text."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 (handler)Core handler logic in JenkinsService.getJobStepsStatus: validates input, constructs WFAPI describe URL using buildJobBuildUrl helper, fetches via axios, handles errors, returns BuildSteps data.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}`); } }
- index.ts:123-127 (schema)Input schema using Zod for jenkins_get_build_steps tool: requires app (string), buildNumber (number), optional branch (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)") },