get_build_log
Retrieve the console output of a Jenkins build by specifying the job path and build number. Use to monitor build details and debug CI/CD pipelines efficiently.
Instructions
Get the console output of a Jenkins build
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| buildNumber | Yes | Build number (use "lastBuild" for most recent) | |
| jobPath | Yes | Path to the Jenkins job |
Implementation Reference
- src/index.ts:195-208 (handler)The main handler function that fetches the console log from Jenkins API endpoint `/{jobPath}/{buildNumber}/consoleText` using axios and returns it as MCP tool response content.private async getBuildLog(args: any) { const response = await this.axiosInstance.get( `/${args.jobPath}/${args.buildNumber}/consoleText` ); return { content: [ { type: 'text', text: response.data, }, ], }; }
- src/index.ts:99-116 (registration)Registers the 'get_build_log' tool in the MCP server's ListTools response, including name, description, and input schema.{ name: 'get_build_log', description: 'Get the console output of a Jenkins build', inputSchema: { type: 'object', properties: { jobPath: { type: 'string', description: 'Path to the Jenkins job', }, buildNumber: { type: 'string', description: 'Build number (use "lastBuild" for most recent)', }, }, required: ['jobPath', 'buildNumber'], }, },
- src/index.ts:102-115 (schema)Input schema definition for the get_build_log tool, specifying required jobPath and optional buildNumber parameters.inputSchema: { type: 'object', properties: { jobPath: { type: 'string', description: 'Path to the Jenkins job', }, buildNumber: { type: 'string', description: 'Build number (use "lastBuild" for most recent)', }, }, required: ['jobPath', 'buildNumber'], },