Skip to main content
Glama

get_running_builds

Retrieve a list of all builds currently running in Jenkins to monitor active build processes.

Instructions

Get all running builds from Jenkins

Returns: A list of all running builds

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler for 'get_running_builds'. Decorated with @mcp.tool, it fetches running builds via the Jenkins client and returns them as a list of dicts with only number, url, building, and timestamp fields.
    @mcp.tool(tags=['read'])
    async def get_running_builds(ctx: Context) -> list[dict]:
        """Get all running builds from Jenkins
    
        Returns:
            A list of all running builds
        """
        return [
            item.model_dump(include={'number', 'url', 'building', 'timestamp'})
            for item in jenkins(ctx).get_running_builds()
        ]
  • The helper method on the Jenkins REST client that actually queries all nodes (depth=2) and collects running builds from their executors.
    def get_running_builds(self) -> list[Build]:
        """Get all running builds across all nodes.
    
        The build obtained through this method only includes the number, url and timestamp.
    
        Returns:
            A list of Build objects representing the running builds.
        """
        builds = []
    
        for node in self.get_nodes(depth=2):
            for executor in node.executors:
                if executor.currentExecutable and executor.currentExecutable.number:
                    builds.append(Build.model_validate(executor.currentExecutable.model_dump(mode='json')))
    
        return builds
  • The Build Pydantic model with fields: number, url, timestamp, duration, estimatedDuration, building, result, nextBuild, previousBuild.
    class Build(BaseModel):
        number: int
        url: str
    
        timestamp: int = None
        duration: int = None
        estimatedDuration: int = None
    
        building: bool = None
        result: str | None = None
    
        nextBuild: Optional['Build'] = None
        previousBuild: Optional['Build'] = None
  • Models for Node, NodeExecutor, and NodeExecutorCurrentExecutable used by get_running_builds to iterate over executors.
    class Node(BaseModel):
        displayName: str
        offline: bool
    
        executors: list['NodeExecutor']
    
    
    class NodeExecutor(BaseModel):
        currentExecutable: Optional['NodeExecutorCurrentExecutable'] = None
    
    
    class NodeExecutorCurrentExecutable(BaseModel):
        url: str = None
        timestamp: int = None
        number: int = None
        fullDisplayName: str = None
  • The MCP server instance (JenkinsMCP) created and then the build module is imported (line 34), which triggers the @mcp.tool decorator registration of get_running_builds.
    mcp = JenkinsMCP('mcp-jenkins', lifespan=lifespan)
    
    # Import tool modules to register them with the MCP server
    # This must happen after mcp is created so the @mcp.tool() decorators can reference it
    from mcp_jenkins.server import build, item, node, plugin, queue, view  # noqa: F401, E402
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. It only states it returns a list of all running builds, but omits behavior like whether it returns builds across all jobs or only accessible ones, and no mention of side effects.

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

Conciseness5/5

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

Two concise sentences front-load the purpose. Every word is functional with no redundancy.

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 no parameters and an output schema present, the description is minimally adequate. However, it leaves ambiguity about the scope (e.g., 'all' across all jobs or user-specific) and does not clarify that it lists currently executing builds.

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?

With zero parameters and 100% schema coverage, the baseline is 3. The description adds no parameter meaning beyond what is obvious from the tool name and schema.

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?

The description clearly states 'Get all running builds from Jenkins', specifying the action (get) and resource (running builds). It distinguishes from siblings like 'get_build' (specific build) and 'get_all_items' (all items).

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 this tool versus alternatives like 'get_build' or 'get_all_queue_items'. No exclusions, prerequisites, or context such as which Jenkins server is targeted.

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/lanbaoshen/mcp-jenkins'

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