jenkins_start_job
Start a Jenkins CI/CD job for a specific application and Git branch to trigger automated builds and deployments.
Instructions
Iniciar un job de Jenkins con una rama específica
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| app | Yes | Nombre de la aplicación | |
| branch | Yes | Rama de Git a construir |
Implementation Reference
- tools/jenkins-service.ts:67-87 (handler)Core implementation of starting a Jenkins job via HTTP POST to the buildWithParameters endpoint with sanitized branch parameter.async startJob(app: string, branch: string): Promise<string> { if (!validateAppName(app)) { throw new Error('Invalid app name.'); } const cleanBranch = sanitizeInput(branch); const jobUrl = `${buildJobUrl('', app, cleanBranch)}/buildWithParameters`; const params = new URLSearchParams(); params.append('BRANCH_TO_BUILD', cleanBranch); params.append('delay', '0sec'); try { await this.client.post(jobUrl, params.toString(), { headers: createFormHeaders(this.config) }); return `Job started successfully for app ${app} on branch ${cleanBranch}`; } catch (error: any) { throw handleHttpError(error, `Failed to start job for app: ${app}, branch: ${cleanBranch}`); } }
- index.ts:73-93 (registration)MCP tool registration for 'jenkins_start_job', including Zod input schema and thin wrapper handler that delegates to JenkinsService.startJob and formats the response.server.tool( "jenkins_start_job", "Iniciar un job de Jenkins con una rama específica", { app: z.string().describe("Nombre de la aplicación"), branch: z.string().describe("Rama de Git a construir") }, async (args) => { try { const result = await getJenkinsService().startJob(args.app, args.branch); return { content: [{ type: "text", text: `🚀 **${result}**` }], }; } catch (error: any) { return { content: [{ type: "text", text: `❌ **Error:** ${error.message}` }], }; } } );
- index.ts:76-79 (schema)Input schema validation using Zod for the jenkins_start_job tool.{ app: z.string().describe("Nombre de la aplicación"), branch: z.string().describe("Rama de Git a construir") },