Skip to main content
Glama
gcorroto
by gcorroto

jenkins_stop_job

Stop a running Jenkins job by specifying the application name and build number. Use this tool to halt ongoing CI/CD pipeline executions in Jenkins.

Instructions

Detener un job de Jenkins en ejecución

Input Schema

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

Implementation Reference

  • Core handler method that performs the HTTP POST request to stop the specified Jenkins build.
    async stopJob(app: string, buildNumber: number, branch: string = 'main'): Promise<string> {
      if (!validateAppName(app)) {
        throw new Error('Invalid app name.');
      }
    
      const jobUrl = `${buildJobBuildUrl('', app, buildNumber, branch)}/stop`;
      
      try {
        await this.client.post(jobUrl);
        return `Job stopped successfully for app ${app}, build ${buildNumber}, branch ${branch}`;
      } catch (error: any) {
        throw handleHttpError(error, `Failed to stop job for app: ${app}, build: ${buildNumber}, branch: ${branch}`);
      }
    }
  • index.ts:96-117 (registration)
    MCP tool registration for 'jenkins_stop_job', including input schema and wrapper handler that calls JenkinsService.stopJob.
    server.tool(
      "jenkins_stop_job",
      "Detener un job de Jenkins en ejecución",
      {
        app: z.string().describe("Nombre de la aplicación"),
        buildNumber: z.number().describe("Número del build a detener"),
        branch: z.string().optional().describe("Rama de Git (por defecto: main)")
      },
      async (args) => {
        try {
          const result = await getJenkinsService().stopJob(args.app, args.buildNumber, args.branch || 'main');
          
          return {
            content: [{ type: "text", text: `🛑 **${result}**` }],
          };
        } catch (error: any) {
          return {
            content: [{ type: "text", text: `❌ **Error:** ${error.message}` }],
          };
        }
      }
    );
  • Zod schema defining the input parameters for the jenkins_stop_job tool.
    {
      app: z.string().describe("Nombre de la aplicación"),
      buildNumber: z.number().describe("Número del build a detener"),
      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