get_plugins_with_backup
Retrieve plugins that have a backup version and can be downgraded or rolled back. Use this tool to identify plugins eligible for version rollback.
Instructions
Get plugins that can be downgraded
Returns plugins that have a backupVersion and can be rolled back.
Args: depth: The depth of the information to retrieve. Default is 0.
Returns: A list of plugins that can be downgraded
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| depth | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |
Implementation Reference
- src/mcp_jenkins/server/plugin.py:49-61 (handler)MCP tool handler that exposes get_plugins_with_backup as a 'read' tool via @mcp.tool decorator. Delegates to the REST client.
@mcp.tool(tags={'read'}) async def get_plugins_with_backup(ctx: Context, depth: int = 0) -> list[dict]: """Get plugins that can be downgraded Returns plugins that have a backupVersion and can be rolled back. Args: depth: The depth of the information to retrieve. Default is 0. Returns: A list of plugins that can be downgraded """ return jenkins(ctx).get_plugins_with_backup(depth=depth) - Tool registration/type decorator marking this tool with 'read' tag.
@mcp.tool(tags={'read'}) async def get_plugins_with_backup(ctx: Context, depth: int = 0) -> list[dict]: - src/mcp_jenkins/server/__init__.py:34-34 (registration)The plugin module is imported here, which triggers the @mcp.tool() decorator registration on the JenkinsMCP instance.
from mcp_jenkins.server import build, item, node, plugin, queue, view # noqa: F401, E402 - REST client implementation that fetches plugin list from Jenkins API and filters for plugins with backupVersion and downgradable=true.
def get_plugins_with_backup(self, depth: int = 0) -> list[dict]: """Get plugins that can be downgraded. Plugins with backupVersion and downgradable=true can be rolled back. Args: depth: The depth of the information to retrieve. Returns: A list of plugins that can be downgraded. """ response = self.request('GET', rest_endpoint.PLUGIN_LIST(depth=depth)) plugins = response.json().get('plugins', []) return [ { 'shortName': p.get('shortName'), 'longName': p.get('longName'), 'version': p.get('version'), 'backupVersion': p.get('backupVersion'), 'downgradable': p.get('downgradable'), } for p in plugins if p.get('backupVersion') and p.get('downgradable') ] - REST endpoint definition for the plugin list API endpoint used by get_plugins_with_backup.
PLUGIN_LIST = RestEndpoint('pluginManager/api/json?depth={depth}')