Skip to main content
Glama
xhuaustc

Jenkins MCP Tool

get_build_log

Retrieve build logs from Jenkins servers to analyze job execution details, troubleshoot failures, and monitor CI/CD pipeline performance.

Instructions

Get Jenkins build log.

Args:
    server_name: Jenkins server name
    job_full_name: Full job name
    build_number: Build number

Returns:
    Build log text

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
server_nameYes
job_full_nameYes
build_numberYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler and registration for 'get_build_log'. Creates JenkinsAPIClient instance and calls its get_build_log method to retrieve the build console log.
    @mcp.tool()
    def get_build_log(server_name: str, job_full_name: str, build_number: int) -> str:
        """Get Jenkins build log.
    
        Args:
            server_name: Jenkins server name
            job_full_name: Full job name
            build_number: Build number
    
        Returns:
            Build log text
        """
        client = JenkinsAPIClient(server_name)
        return client.get_build_log(job_full_name, build_number)
  • Core implementation of get_build_log in JenkinsAPIClient. Fetches the build console log text from the Jenkins API endpoint /{build_number}/consoleText, handling 404 errors by raising JenkinsBuildNotFoundError.
    def get_build_log(self, job_full_name: str, build_number: int) -> str:
        """Get build log.
    
        Args:
            job_full_name: Full job name
            build_number: Build number
    
        Returns:
            Build log text
    
        Raises:
            JenkinsBuildNotFoundError: Build not found
            JenkinsError: API request failed
        """
        job_url = self._build_job_url(job_full_name)
        log_url = f"{job_url}/{build_number}/consoleText"
    
        response = self._make_request("GET", log_url)
    
        if response.status_code == 404:
            raise JenkinsBuildNotFoundError(
                build_number, job_full_name, self.server_name
            )
    
        response.raise_for_status()
        return response.text
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. While 'Get' implies a read operation, the description doesn't mention authentication requirements, rate limits, error conditions, or whether this retrieves full or partial logs. For a tool with zero annotation coverage, this leaves significant behavioral gaps.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is efficiently structured with a clear purpose statement followed by parameter and return sections. Every sentence serves a purpose, though the parameter descriptions could be more informative. The front-loaded purpose statement makes the tool's function immediately apparent.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 3 parameters with 0% schema coverage and no annotations, the description is minimally adequate but incomplete. The presence of an output schema means return values are documented elsewhere, reducing the burden. However, for a tool that likely requires specific Jenkins knowledge and has behavioral implications, more context about authentication, error handling, and parameter formats would be beneficial.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description lists all three parameters with brief labels, but schema description coverage is 0%, so parameters lack documentation in both schema and description. The description adds minimal semantic value by naming the parameters but doesn't explain what constitutes a valid 'server_name', 'job_full_name' format, or 'build_number' range, leaving them essentially undocumented.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the verb 'Get' and resource 'Jenkins build log', making the purpose immediately understandable. However, it doesn't differentiate from sibling tools like 'get_build_status' or 'get_job_parameters' that also retrieve build-related information, so it doesn't reach the highest clarity level.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. With sibling tools like 'get_build_status' and 'get_job_parameters' available, there's no indication whether this tool should be used for log retrieval specifically versus other build information, nor any prerequisites or exclusions mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/xhuaustc/jenkins-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server