get_build_status
Check Jenkins job build status and details by specifying job name and optional build number to monitor pipeline execution.
Instructions
Get build status
Args:
job_name: Name of the job
build_number: Build number to check, defaults to latest
Returns:
Build information dictionary
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| job_name | Yes | ||
| build_number | No |
Implementation Reference
- jenkins_mcp/server.py:253-270 (handler)The handler function implementing the 'get_build_status' tool logic. It fetches the Jenkins client from context, determines the build number if not provided by getting the last build from job info, and returns the build information using the Jenkins library. The @mcp.tool() decorator registers this function as an MCP tool.@mcp.tool() def get_build_status( ctx: Context, job_name: str, build_number: Optional[int] = None ) -> dict: """Get build status Args: job_name: Name of the job build_number: Build number to check, defaults to latest Returns: Build information dictionary """ client = ctx.request_context.lifespan_context.client if build_number is None: build_number = client.get_job_info(job_name)["lastBuild"]["number"] return client.get_build_info(job_name, build_number)