get_item_config
Retrieve the configuration of a Jenkins item using its fullname to access its current settings.
Instructions
Get specific item config from Jenkins
Args: fullname: The fullname of the item
Returns: The config of the item
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| fullname | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_jenkins/server/item.py:33-43 (handler)MCP tool handler for 'get_item_config'. Annotated with @mcp.tool(tags=['read']). Calls jenkins(ctx).get_item_config(fullname=fullname) and returns the XML config string.
@mcp.tool(tags=['read']) async def get_item_config(ctx: Context, fullname: str) -> str: """Get specific item config from Jenkins Args: fullname: The fullname of the item Returns: The config of the item """ return jenkins(ctx).get_item_config(fullname=fullname) - REST client implementation of get_item_config. Parses the fullname into folder/name, makes a GET request to ITEM_CONFIG endpoint, and returns the response text (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 - REST endpoint template for item config: '{folder}job/{name}/config.xml'. Uses the RestEndpoint class which formats the URL template at call time.
ITEM_CONFIG = RestEndpoint('{folder}job/{name}/config.xml') - src/mcp_jenkins/server/item.py:33-34 (registration)The @mcp.tool(tags=['read']) decorator on the get_item_config function registers it as an MCP tool. The mcp instance is created in src/mcp_jenkins/server/__init__.py and item.py is imported there (line 34) to trigger registration.
@mcp.tool(tags=['read']) async def get_item_config(ctx: Context, fullname: str) -> str: - tests/test_server/test_item.py:54-58 (helper)Test for the get_item_config MCP tool handler. Mocks jenkins.get_item_config to return an XML string and asserts the handler returns it.
@pytest.mark.asyncio async def test_get_item_config(mock_jenkins, mocker): mock_jenkins.get_item_config.return_value = '<xml>config</xml>' assert await item.get_item_config(mocker.Mock(), fullname='job1') == '<xml>config</xml>'