get_build_status
Retrieve Jenkins build status by specifying the server name, job full name, and build number to monitor CI/CD pipeline progress and ensure build integrity.
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 |
|---|---|---|---|
| build_number | Yes | ||
| job_full_name | Yes | ||
| server_name | Yes |
Implementation Reference
- src/jenkins/tools/mcp_tools.py:175-189 (handler)MCP tool handler for get_build_status, decorated with @mcp.tool(). Creates JenkinsAPIClient instance and delegates to client.get_build_status(job_full_name, build_number). This is the entry point for the MCP tool execution.@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 helper method in JenkinsAPIClient that performs the HTTP GET request to the Jenkins build API endpoint and parses the JSON response into a BuildInfo dictionary.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), }
- src/jenkins/tools/types.py:88-97 (schema)TypedDict definition for BuildInfo, which specifies the structure of the output returned by get_build_status (number, result, building, url, timestamp, duration).class BuildInfo(TypedDict): """Build info.""" number: int result: Optional[str] building: bool url: str timestamp: int duration: int