Skip to main content
Glama
gcorroto
by gcorroto

jenkins_get_pending_actions

Retrieve pending input actions for a Jenkins build to check for required approvals or parameters before proceeding with the CI/CD pipeline.

Instructions

Obtener las acciones pendientes de input de un build

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
appYesNombre de la aplicación
buildNumberYesNúmero del build
branchNoRama de Git (por defecto: main)

Implementation Reference

  • index.ts:198-228 (registration)
    MCP tool registration for 'jenkins_get_pending_actions', including input schema and handler function that calls JenkinsService and formats response.
    server.tool(
      "jenkins_get_pending_actions",
      "Obtener las acciones pendientes de input de un build",
      {
        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().getPendingInputActions(args.app, args.buildNumber, args.branch || 'main');
          
          const pendingText = `⏳ **Acciones Pendientes - Build #${args.buildNumber}**\n\n` +
            `**ID:** ${result.id}\n` +
            `**Proceed URL:** ${result.proceedUrl}\n` +
            `**Abort URL:** ${result.abortUrl}\n` +
            (result.message ? `**Mensaje:** ${result.message}\n` : '') +
            (result.inputs && result.inputs.length > 0 ? 
              `**Inputs requeridos:**\n${result.inputs.map(input => `- ${input.name}: ${input.description || 'N/A'}`).join('\n')}`
              : '');
    
          return {
            content: [{ type: "text", text: pendingText }],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `❌ **Error:** ${error.message}` }],
          };
        }
      }
    );
  • Core handler logic in JenkinsService: constructs Jenkins API URL for pending input actions and fetches data via Axios.
    async getPendingInputActions(app: string, buildNumber: number, branch: string = 'main'): Promise<PendingInputAction> {
      if (!validateAppName(app)) {
        throw new Error('Invalid app name.');
      }
    
      const pendingInputUrl = `${buildJobBuildUrl('', app, buildNumber, branch)}/wfapi/nextPendingInputAction`;
      
      try {
        const response: AxiosResponse<PendingInputAction> = await this.client.get(pendingInputUrl);
        return response.data;
      } catch (error: any) {
        throw handleHttpError(error, `Failed to get pending input actions for app: ${app}, build: ${buildNumber}, branch: ${branch}`);
      }
    }
  • Input schema using Zod for validating tool parameters: app, buildNumber, and optional branch.
      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)")
    },

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