Skip to main content
Glama
mdtahmidhossain

jenkins-http-mcp-server

jenkins_get_build_log

Fetch the console log text for a specific Jenkins build, truncated to a configurable maximum byte size.

Instructions

Get consoleText for a build, truncated by JENKINS_MCP_MAX_LOG_BYTES.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
jobYes
buildYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The tool handler function that fetches a build's consoleText with a size limit. It is decorated with @mcp.tool() and registered via register_tools().
    @mcp.tool()
    def jenkins_get_build_log(job: str | list[str], build: int | str) -> dict[str, Any]:
        """Get consoleText for a build, truncated by JENKINS_MCP_MAX_LOG_BYTES."""
    
        def op() -> dict[str, Any]:
            with _client() as client:
                return client.get_text_limited(
                    f"{_build_path(job, build)}/consoleText",
                    limit=client.config.max_log_bytes,
                )
    
        return _run(op)
  • Helper method on JenkinsClient that streams the consoleText response, truncating at the configured byte limit and returning metadata about truncation.
    def get_text_limited(self, path: str, *, limit: int) -> dict[str, Any]:
        url, relative = self._url(path)
        collected = bytearray()
        truncated = False
        with self.http.stream("GET", url) as response:
            self._raise_for_status(response, "GET", relative)
            for chunk in response.iter_bytes():
                remaining = limit - len(collected)
                if remaining <= 0:
                    truncated = True
                    break
                if len(chunk) > remaining:
                    collected.extend(chunk[:remaining])
                    truncated = True
                    break
                collected.extend(chunk)
        return {
            "text": collected.decode("utf-8", errors="replace"),
            "bytes_returned": len(collected),
            "truncated": truncated,
            "limit": limit,
        }
  • Schema/config field for max_log_bytes (default 200,000), configurable via JENKINS_MCP_MAX_LOG_BYTES environment variable.
    max_log_bytes: int = 200_000
  • Registration of jenkins_get_build_log as a read-only tool in the READ_ONLY_TOOLS list.
    READ_ONLY_TOOLS = [
        "jenkins_whoami",
        "jenkins_version",
        "jenkins_health",
        "jenkins_get_json",
        "jenkins_list_jobs",
        "jenkins_get_job",
        "jenkins_get_job_config",
        "jenkins_list_builds",
        "jenkins_get_build",
        "jenkins_get_build_log",
        "jenkins_get_build_artifacts",
        "jenkins_get_test_report",
        "jenkins_list_queue",
        "jenkins_get_queue_item",
        "jenkins_list_views",
        "jenkins_get_view",
        "jenkins_list_nodes",
        "jenkins_get_node",
        "jenkins_list_plugins",
    ]
Behavior3/5

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

Discloses truncation by environment variable, but lacks details on read-only nature, auth requirements, or other behaviors. No annotations to supplement.

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?

Single sentence, front-loaded with key info. Efficient but could be slightly more structured.

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?

Output schema exists but isn't described; still, log retrieval is simple. Missing details like error handling or format.

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

Parameters2/5

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

Schema has 0% description coverage and description adds no semantics for 'job' or 'build' parameters beyond their types.

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

Purpose5/5

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

Clearly states it gets consoleText for a build, with truncation behavior. Distinguishes from sibling tools like jenkins_get_build and jenkins_get_build_artifacts.

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?

No guidance on when to use or avoid this tool. No mention of prerequisites or alternatives.

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/mdtahmidhossain/jenkins-http-mcp-server'

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