Skip to main content
Glama
gcorroto
by gcorroto

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
NameRequiredDescriptionDefault
appYesNombre de la aplicación
buildNumberYesNúmero del build
branchNoRama de Git (por defecto: main)

Implementation Reference

  • 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}` }], }; } }
  • 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}` }], }; } } );
  • 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}`); } }

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/gcorroto/mcp-jenkins'

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