Skip to main content
Glama
xhuaustc

Jenkins MCP Tool

get_job_parameters

Retrieve parameter definitions for a Jenkins job, including names, types, default values, and options for choice parameters.

Instructions

Get the parameter definitions of a Jenkins job.

Args:
    server_name: Jenkins server name
    job_full_name: Full job name

Returns:
    List of parameter definitions, including parameter name, type, default value, and options (if choice parameter)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
server_nameYes
job_full_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • MCP tool handler for 'get_job_parameters', decorated with @mcp.tool(). Creates JenkinsAPIClient and delegates to its get_job_parameters method.
    @mcp.tool()
    def get_job_parameters(server_name: str, job_full_name: str) -> List[JobParameter]:
        """Get the parameter definitions of a Jenkins job.
    
        Args:
            server_name: Jenkins server name
            job_full_name: Full job name
    
        Returns:
            List of parameter definitions, including parameter name, type, default value, and options (if choice parameter)
        """
        client = JenkinsAPIClient(server_name)
        return client.get_job_parameters(job_full_name)
  • TypedDict schema definition for JobParameter, used as the return type for get_job_parameters tool.
    class JobParameter(TypedDict):
        """Job parameter definition."""
    
        name: str
        type: str
        default: Optional[Any]
        choices: Optional[List[str]]
  • Core helper method in JenkinsAPIClient that implements the logic to fetch and parse Jenkins job parameters from the API.
    def get_job_parameters(self, job_full_name: str) -> List[JobParameter]:
        """Get job parameter definitions.
    
        Args:
            job_full_name: Full job name
    
        Returns:
            List of parameter definitions
    
        Raises:
            JenkinsError: API request failed
        """
        job_url = self._build_job_url(job_full_name)
        api_url = (
            f"{job_url}/api/json?tree=actions[parameterDefinitions[name,type,"
            "defaultParameterValue[value],choices]],property[parameterDefinitions"
            "[name,type,defaultParameterValue[value],choices]]"
        )
    
        response = self._make_request("GET", api_url)
        response.raise_for_status()
    
        data = response.json()
        params = []
    
        def process_parameter(param_def: Dict[str, Any]) -> JobParameter:
            """Process parameter definition."""
            param_info: JobParameter = {
                "name": param_def.get("name", ""),
                "type": param_def.get("type", ""),
                "default": param_def.get("defaultParameterValue", {}).get("value"),
                "choices": None,
            }
    
            # If Choice Parameter, add choices list
            if (
                param_def.get("type") == "ChoiceParameterDefinition"
                and "choices" in param_def
            ):
                param_info["choices"] = param_def.get("choices", [])
    
            return param_info
    
        # Process property field
        for prop in data.get("property", []):
            if "parameterDefinitions" in prop:
                for param_def in prop["parameterDefinitions"]:
                    params.append(process_parameter(param_def))
    
        # Process actions field (compatibility)
        for action in data.get("actions", []):
            if "parameterDefinitions" in action:
                for param_def in action["parameterDefinitions"]:
                    params.append(process_parameter(param_def))
    
        return params
  • @mcp.tool() decorator registers the get_job_parameters function as an MCP tool.
    @mcp.tool()
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure. It states this is a read operation ('Get'), but doesn't mention authentication requirements, rate limits, error conditions, or whether it's idempotent. For a tool accessing Jenkins parameters, this leaves significant gaps in understanding its behavior.

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?

The description is perfectly structured: a clear purpose statement followed by organized Args and Returns sections. Every sentence adds value with zero redundancy, making it easy to parse and understand quickly.

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?

Given the tool's moderate complexity (2 parameters, read-only operation), the description covers the essential purpose, parameters, and return format. The presence of an output schema means the description doesn't need to detail return values, but it still lacks behavioral context (auth, errors) that would make it fully complete.

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 explicitly lists both parameters (server_name and job_full_name) and explains their purpose, adding meaningful context beyond the schema (which has 0% description coverage). However, it doesn't provide format examples or constraints (e.g., job naming conventions), keeping it at baseline level.

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 the resource 'parameter definitions of a Jenkins job', making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from its siblings (like get_build_status or get_scenario_list), which would require a 5.

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. It doesn't mention prerequisites (e.g., needing an existing job), exclusions, or how it differs from sibling tools like search_jobs, leaving the agent to infer usage context.

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