get_item_parameters
Get parameter definitions of a Jenkins job: name, type, defaultValue, and description. Provide the job's fullname to receive the list.
Instructions
Get the parameter definitions of a Jenkins job
Args: fullname: The fullname of the item
Returns: A list of parameter definitions, each containing name, type, defaultValue, and description
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fullname | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_jenkins/server/item.py:107-131 (handler)The actual handler function for the 'get_item_parameters' tool. It fetches the Jenkins job config XML, parses it with ElementTree, and extracts parameter definitions (name, type, defaultValue, description).
@mcp.tool(tags=['read']) async def get_item_parameters(ctx: Context, fullname: str) -> list[dict]: """Get the parameter definitions of a Jenkins job Args: fullname: The fullname of the item Returns: A list of parameter definitions, each containing name, type, defaultValue, and description """ config_xml = jenkins(ctx).get_item_config(fullname=fullname) root = ET.fromstring(config_xml) params = [] for param in root.iter('parameterDefinitions'): for definition in param: entry = { 'name': definition.findtext('name', ''), 'type': definition.tag, 'defaultValue': definition.findtext('defaultValue', ''), 'description': definition.findtext('description', ''), } params.append(entry) return params - src/mcp_jenkins/server/item.py:7-8 (registration)The tool registration mechanism: 'from mcp_jenkins.server import mcp' imports the FastMCP instance, and the '@mcp.tool(tags=['read'])' decorator registers the function as an MCP tool.
from mcp_jenkins.server import mcp - src/mcp_jenkins/server/__init__.py:30-34 (registration)The MCP server instance initialization and tool module imports. The 'mcp' object is created, then the 'item' module is imported (line 34), which triggers @mcp.tool decorators to register all tools including get_item_parameters.
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 - The helper function 'get_item_config' in the Jenkins REST client. It gets the XML configuration of a Jenkins item by fullname, which get_item_parameters calls to retrieve the job config XML.
def get_item_config(self, *, fullname: str) -> str: """Get item configuration by its fullname. Args: fullname: The full name of the item (e.g., "folder1/folder2/item"). Returns: The item configuration as an XML string. """ folder, name = self._parse_fullname(fullname) response = self.request('GET', rest_endpoint.ITEM_CONFIG(folder=folder, name=name)) return response.text