get_build_status
Retrieve the current status of a Jenkins build by providing the job path and build number. Use 'lastBuild' to fetch the most recent build's status.
Instructions
Get the status of a Jenkins build
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| buildNumber | No | Build number (use "lastBuild" for most recent) | |
| jobPath | Yes | Path to the Jenkins job (e.g., "view/xxx_debug") |
Implementation Reference
- src/index.ts:150-170 (handler)The handler function that executes the get_build_status tool: fetches build status from Jenkins API using axios and returns formatted JSON content.private async getBuildStatus(args: any) { const buildNumber = args.buildNumber || 'lastBuild'; const response = await this.axiosInstance.get<BuildStatus>( `/${args.jobPath}/${buildNumber}/api/json` ); return { content: [ { type: 'text', text: JSON.stringify({ building: response.data.building, result: response.data.result, timestamp: response.data.timestamp, duration: response.data.duration, url: response.data.url, }, null, 2), }, ], }; }
- src/index.ts:62-79 (registration)Tool registration in the ListTools handler, defining name, description, and input schema.{ name: 'get_build_status', description: 'Get the status of a Jenkins build', inputSchema: { type: 'object', properties: { jobPath: { type: 'string', description: 'Path to the Jenkins job (e.g., "view/xxx_debug")', }, buildNumber: { type: 'string', description: 'Build number (use "lastBuild" for most recent)', }, }, required: ['jobPath'], }, },
- src/index.ts:16-22 (schema)TypeScript interface defining the structure of the Jenkins build status response used in the handler.interface BuildStatus { building: boolean; result: string | null; timestamp: number; duration: number; url: string; }