Skip to main content
Glama

get_plugin_dependency_graph

Recursively analyze Jenkins plugin dependencies to leaf nodes and return nodes and edges for Graphviz graph rendering.

Instructions

Get dependency graph for a specific plugin in Graphviz format

Recursively analyzes dependencies down to leaf nodes. Returns nodes and edges that can be used to generate a dependency graph.

Args: short_name: The short name of the plugin to analyze

Returns: A dictionary with 'nodes' and 'edges' for Graphviz rendering

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
short_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The MCP tool handler function that exposes get_plugin_dependency_graph as a 'read' tool. Delegates to the REST client.
    async def get_plugin_dependency_graph(ctx: Context, short_name: str) -> dict:
        """Get dependency graph for a specific plugin in Graphviz format
    
        Recursively analyzes dependencies down to leaf nodes.
        Returns nodes and edges that can be used to generate a dependency graph.
    
        Args:
            short_name: The short name of the plugin to analyze
    
        Returns:
            A dictionary with 'nodes' and 'edges' for Graphviz rendering
        """
        return jenkins(ctx).get_plugin_dependency_graph(short_name=short_name)
  • The core implementation of get_plugin_dependency_graph. Recursively traverses plugin dependencies, building nodes and edges for a Graphviz graph.
    def get_plugin_dependency_graph(self, short_name: str) -> dict:
        """Get dependency graph for a specific plugin in Graphviz format.
    
        Recursively analyzes dependencies down to leaf nodes (plugins with no dependencies).
    
        Args:
            short_name: The short name of the plugin to analyze.
    
        Returns:
            A dictionary containing 'nodes' and 'edges' for Graphviz rendering.
        """
        plugins = self.get_plugins(depth=2)
        installed = {p['shortName']: p for p in plugins}
    
        if short_name not in installed:
            return {'nodes': [], 'edges': [], 'error': f'Plugin not found: {short_name}'}
    
        nodes = []
        edges = []
        visited = set()
    
        def traverse(name: str) -> None:
            if name in visited:
                return
            visited.add(name)
    
            if name not in installed:
                nodes.append({'id': name, 'label': name, 'status': 'missing'})
                return
    
            plugin = installed[name]
            nodes.append(
                {
                    'id': name,
                    'label': f'{name}\n({plugin.get("version", "?")})',
                    'status': 'installed',
                }
            )
    
            deps = plugin.get('dependencies', [])
            for dep in deps:
                dep_name = dep.get('shortName', '')
                edges.append({'from': name, 'to': dep_name})
                traverse(dep_name)
    
        traverse(short_name)
    
        return {'nodes': nodes, 'edges': edges}
  • The MCP server instance (JenkinsMCP) is created here. The @mcp.tool decorator in plugin.py registers the tool via the 'mcp' instance imported from this module.
    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
  • Test that validates get_plugin_dependency_graph returns correct nodes and edges for a plugin with dependencies.
    async def test_get_plugin_dependency_graph(mock_jenkins, mocker):
        mock_jenkins.get_plugin_dependency_graph.return_value = {
            'nodes': [
                {'id': 'plugin-a', 'label': 'plugin-a\n(1.0)', 'status': 'installed'},
                {'id': 'dep-a', 'label': 'dep-a\n(1.0)', 'status': 'installed'},
            ],
            'edges': [{'from': 'plugin-a', 'to': 'dep-a'}],
        }
    
        result = await plugin.get_plugin_dependency_graph(mocker.Mock(), short_name='plugin-a')
        assert result == {
            'nodes': [
                {'id': 'plugin-a', 'label': 'plugin-a\n(1.0)', 'status': 'installed'},
                {'id': 'dep-a', 'label': 'dep-a\n(1.0)', 'status': 'installed'},
            ],
            'edges': [{'from': 'plugin-a', 'to': 'dep-a'}],
        }
Behavior3/5

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

No annotations exist, so the description must disclose behavior. It states recursive analysis and returns nodes/edges, but lacks error handling details, authorization needs, or side effects. Sufficient for a simple read operation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with an opening line, a brief behavior note, and clear Args/Returns sections. It could be slightly shorter by combining the first two sentences, but overall it's efficient.

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?

For a single-parameter read-only tool, the description covers the core functionality and output format. Lacks details on recursion depth, cycle handling, or error responses, but is mostly complete given the tool's simplicity and presence of an output schema.

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 only parameter, 'short_name', is described in the Args section as 'The short name of the plugin to analyze', but this adds minimal meaning beyond the name. Schema coverage is 0%, so the description barely compensates.

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?

The description clearly states the tool retrieves a dependency graph in Graphviz format for a specific plugin, with recursive analysis. It distinguishes from siblings like 'get_plugin' by focusing on graph generation.

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?

No guidance on when to use this versus alternatives, no prerequisites, and no mention of when not to use. The description only explains what it does, not its context relative to sibling tools.

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