jenkins_get_node_status
Check the status of a specific node in a Jenkins build to monitor pipeline execution and identify issues in CI/CD workflows.
Instructions
Obtener el estado de un nodo específico de un build
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app | Yes | Nombre de la aplicación | |
| buildNumber | Yes | Número del build | |
| nodeId | Yes | ID del nodo | |
| branch | No | Rama de Git (por defecto: main) |
Implementation Reference
- index.ts:164-194 (handler)The MCP tool handler function that calls the JenkinsService to retrieve node status and formats the response as formatted text.async (args) => { try { const result = await getJenkinsService().getNodeStatus(args.app, args.buildNumber, args.nodeId, args.branch || 'main'); let statusText: string; if ('proceedUrl' in result) { // Es un PendingInputAction statusText = `⏸️ **Nodo Esperando Input - ${args.nodeId}**\n\n` + `**ID:** ${result.id}\n` + `**Proceed URL:** ${result.proceedUrl}\n` + `**Abort URL:** ${result.abortUrl}\n` + (result.message ? `**Mensaje:** ${result.message}` : ''); } else { // Es un NodeStatus normal statusText = `🔍 **Estado del Nodo: ${args.nodeId}**\n\n` + `**Nombre:** ${result.name}\n` + `**Estado:** ${result.status}\n` + `**Duración:** ${formatDuration(result.durationMillis)}\n` + `**Inicio:** ${formatTimestamp(result.startTimeMillis)}`; } return { content: [{ type: "text", text: statusText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } }
- index.ts:158-162 (schema)Zod schema defining the input parameters for the jenkins_get_node_status tool.{ app: z.string().describe("Nombre de la aplicación"), buildNumber: z.number().describe("Número del build"), nodeId: z.string().describe("ID del nodo"), branch: z.string().optional().describe("Rama de Git (por defecto: main)")
- index.ts:155-195 (registration)Registration of the jenkins_get_node_status tool using server.tool, including description, schema, and handler.server.tool( "jenkins_get_node_status", "Obtener el estado de un nodo específico de un build", { app: z.string().describe("Nombre de la aplicación"), buildNumber: z.number().describe("Número del build"), nodeId: z.string().describe("ID del nodo"), branch: z.string().optional().describe("Rama de Git (por defecto: main)") }, async (args) => { try { const result = await getJenkinsService().getNodeStatus(args.app, args.buildNumber, args.nodeId, args.branch || 'main'); let statusText: string; if ('proceedUrl' in result) { // Es un PendingInputAction statusText = `⏸️ **Nodo Esperando Input - ${args.nodeId}**\n\n` + `**ID:** ${result.id}\n` + `**Proceed URL:** ${result.proceedUrl}\n` + `**Abort URL:** ${result.abortUrl}\n` + (result.message ? `**Mensaje:** ${result.message}` : ''); } else { // Es un NodeStatus normal statusText = `🔍 **Estado del Nodo: ${args.nodeId}**\n\n` + `**Nombre:** ${result.name}\n` + `**Estado:** ${result.status}\n` + `**Duración:** ${formatDuration(result.durationMillis)}\n` + `**Inicio:** ${formatTimestamp(result.startTimeMillis)}`; } return { content: [{ type: "text", text: statusText }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } } );
- tools/jenkins-service.ts:134-154 (helper)JenkinsService.getNodeStatus method that performs the API call to retrieve the node status from Jenkins workflow API and handles special PAUSED_PENDING_INPUT case.async getNodeStatus(app: string, buildNumber: number, nodeId: string, branch: string = 'main'): Promise<NodeStatus | PendingInputAction> { if (!validateAppName(app)) { throw new Error('Invalid app name.'); } const nodeUrl = `${buildJobBuildUrl('', app, buildNumber, branch)}/execution/node/${nodeId}/wfapi/describe`; try { const response: AxiosResponse<NodeStatus> = await this.client.get(nodeUrl); const nodeDetails = response.data; // Si el estado es PAUSED_PENDING_INPUT, obtener los detalles de input pending if (nodeDetails.status === 'PAUSED_PENDING_INPUT') { return await this.getPendingInputActions(app, buildNumber, branch); } return nodeDetails; } catch (error: any) { throw handleHttpError(error, `Failed to get node status for app: ${app}, build: ${buildNumber}, node: ${nodeId}, branch: ${branch}`); } }