get_build_status
Retrieve Jenkins build status by specifying server name, job name, and build number to monitor CI/CD pipeline execution results.
Instructions
Get the Jenkins build status for the specified build_number.
Args:
server_name: Jenkins server name
job_full_name: Full job name
build_number: Build number
Returns:
Build status info
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| server_name | Yes | ||
| job_full_name | Yes | ||
| build_number | Yes |
Implementation Reference
- src/jenkins/tools/mcp_tools.py:175-189 (handler)MCP tool handler for 'get_build_status', registered via @mcp.tool() decorator. Creates JenkinsAPIClient and delegates to its get_build_status method.@mcp.tool() def get_build_status(server_name: str, job_full_name: str, build_number: int) -> dict: """Get the Jenkins build status for the specified build_number. Args: server_name: Jenkins server name job_full_name: Full job name build_number: Build number Returns: Build status info """ client = JenkinsAPIClient(server_name) return client.get_build_status(job_full_name, build_number)
- src/jenkins/tools/client.py:382-417 (helper)Core implementation in JenkinsAPIClient that queries the Jenkins API for the specific build's JSON data and returns structured BuildInfo.def get_build_status(self, job_full_name: str, build_number: int) -> BuildInfo: """Get build status. Args: job_full_name: Full job name build_number: Build number Returns: Build info Raises: JenkinsBuildNotFoundError: Build not found JenkinsError: API request failed """ job_url = self._build_job_url(job_full_name) api_url = f"{job_url}/{build_number}/api/json" response = self._make_request("GET", api_url) if response.status_code == 404: raise JenkinsBuildNotFoundError( build_number, job_full_name, self.server_name ) response.raise_for_status() data = response.json() return { "number": data.get("number", build_number), "result": data.get("result"), "building": data.get("building", False), "url": data.get("url", ""), "timestamp": data.get("timestamp", 0), "duration": data.get("duration", 0), }