getBuild
Retrieve detailed information about specific Jenkins builds or the last build for monitoring, analysis, and automation workflows.
Instructions
Get information about a specific build or the last build
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| buildNumber | No | Build number (optional, defaults to last build) | |
| jobFullName | Yes | Full path of the Jenkins job |
Implementation Reference
- src/tools/job-info.js:36-57 (handler)The main handler function for the 'getBuild' tool. It retrieves information about a specific Jenkins build or the last build by making an API call to the Jenkins server, handling errors and validation.export async function getBuild(client, args) { const { jobFullName, buildNumber = null } = args; if (!jobFullName) return failure("getBuild", "jobFullName is required"); const jobPath = encodeJobPath(jobFullName); const buildPath = buildNumber || "lastBuild"; try { const response = await client.get( `/job/${jobPath}/${buildPath}/api/json` ); if (response.status === 200) { return success("getBuild", { build: response.data }); } return failure( "getBuild", `Build not found: ${jobFullName}#${buildPath}`, { statusCode: response.status } ); } catch (error) { return formatError(error, "getBuild"); } }
- src/tools/index.js:152-166 (schema)Input schema defining the parameters for the 'getBuild' tool: jobFullName (required string) and optional buildNumber (integer).inputSchema: { type: "object", properties: { jobFullName: { type: "string", description: "Full path of the Jenkins job", }, buildNumber: { type: "integer", description: "Build number (optional, defaults to last build)", }, }, required: ["jobFullName"], },
- src/tools/index.js:149-168 (registration)Registration of the 'getBuild' tool in the central tool registry, including name, description, input schema, and reference to the handler function.getBuild: { name: "getBuild", description: "Get information about a specific build or the last build", inputSchema: { type: "object", properties: { jobFullName: { type: "string", description: "Full path of the Jenkins job", }, buildNumber: { type: "integer", description: "Build number (optional, defaults to last build)", }, }, required: ["jobFullName"], }, handler: getBuild, },