Skip to main content
Glama

get_build_parameters

Retrieve build parameters from Jenkins by job fullname and build number. Returns a dictionary of parameter names and values; omitting number fetches the last build.

Instructions

Get the parameters of a specific build in Jenkins

Args: fullname: The fullname of the job number: The number of the build, if None, get the last build

Returns: A dictionary of build parameter names and their values

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
fullnameYes
numberNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • MCP tool handler function 'get_build_parameters' decorated with @mcp.tool(tags=['read']). Takes a Jenkins context, job fullname, and optional build number. If number is None, it fetches the last build number. Delegates to jenkins(ctx).get_build_parameters().
    @mcp.tool(tags=['read'])
    async def get_build_parameters(ctx: Context, fullname: str, number: int | None = None) -> dict:
        """Get the parameters of a specific build in Jenkins
    
        Args:
            fullname: The fullname of the job
            number: The number of the build, if None, get the last build
    
        Returns:
            A dictionary of build parameter names and their values
        """
        if number is None:
            number = jenkins(ctx).get_item(fullname=fullname, depth=1).lastBuild.number
    
        return jenkins(ctx).get_build_parameters(fullname=fullname, number=number)
  • Core implementation method 'get_build_parameters' on the Jenkins REST client class. Parses the fullname into folder/name, makes a GET request to the BUILD_PARAMETERS endpoint, and extracts parameters from the 'actions' array in the JSON response, returning a dict of name->value pairs.
    def get_build_parameters(self, *, fullname: str, number: int) -> dict:
        """Get the build parameters of a specific build.
    
        Args:
            fullname: The fullname of the job.
            number: The build number.
    
        Returns:
            A dictionary representing the build parameters.
        """
        folder, name = self._parse_fullname(fullname)
        response = self.request(
            'GET',
            rest_endpoint.BUILD_PARAMETERS(folder=folder, name=name, number=number),
        )
    
        for action in response.json().get('actions', []):
            if 'parameters' in action:
                return {p['name']: p.get('value') for p in action['parameters']}
        return {}
  • REST endpoint definition 'BUILD_PARAMETERS' as a RestEndpoint string template. Maps to the Jenkins API URL: '{folder}job/{name}/{number}/api/json?tree=actions[parameters[name,value]]'.
    BUILD_PARAMETERS = RestEndpoint('{folder}job/{name}/{number}/api/json?tree=actions[parameters[name,value]]')
  • Test for 'get_build_parameters' handler. Mocks the Jenkins client and asserts the handler correctly returns the parameters dictionary.
    @pytest.mark.asyncio
    async def test_get_build_parameters(mock_jenkins, mocker):
        mock_jenkins.get_item.return_value.lastBuild.number = 1
        mock_jenkins.get_build_parameters.return_value = {'BRANCH': 'main', 'DEBUG': True}
    
        assert await build.get_build_parameters(mocker.Mock(), fullname='job1') == {
            'BRANCH': 'main',
            'DEBUG': True,
        }
Behavior3/5

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

No annotations provided. Description mentions default behavior for 'number' parameter but does not disclose read-only nature, permissions, or error handling. Adequate but incomplete.

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?

Three lines with no extraneous text. Front-loaded with action and resource. Efficient and clear.

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

Completeness4/5

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

Covers input parameters, default behavior, and return type (dictionary). Lacks mention of read-only nature or potential errors, but sufficient for a simple query tool.

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

Parameters5/5

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

With 0% schema description coverage, the description explains both parameters: 'fullname' as job fullname and 'number' with meaning and default behavior ('if None, get the last build'). Adds significant value beyond schema 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 the verb 'Get', resource 'parameters of a specific build', and context 'Jenkins'. Distinguishes from siblings like get_build (build details) and get_item_parameters (job parameters).

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

Usage Guidelines4/5

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

Includes usage note about 'if None, get the last build'. Does not explicitly compare with alternatives, but the purpose is clear enough.

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