Skip to main content
Glama

get_all_items

Retrieve a complete list of all items from your Jenkins instance. Use this tool to enumerate all configured items for further processing.

Instructions

Get all items from Jenkins

Returns: A list of items

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The MCP tool handler 'get_all_items' decorated with @mcp.tool(tags=['read']). It calls jenkins(ctx).get_items() and returns a list of model dicts.
    @mcp.tool(tags=['read'])
    async def get_all_items(ctx: Context) -> list[dict]:
        """Get all items from Jenkins
    
        Returns:
            A list of items
        """
        return [item.model_dump(exclude_none=True) for item in jenkins(ctx).get_items()]
  • Imports for the handler: xml.etree, Context from fastmcp, the jenkins helper from lifespan, and the mcp server instance for registration.
    import xml.etree.ElementTree as ET
    from typing import Literal
    
    from fastmcp import Context
    
    from mcp_jenkins.core.lifespan import jenkins
    from mcp_jenkins.server import mcp
  • The 'get_items' method on the Jenkins class which implements the actual logic to fetch items by querying the Jenkins REST API and recursively traversing folders.
    def get_items(self, *, folder_depth: int | None = None, folder_depth_per_request: int = 10) -> list[ItemType]:
        """Get items in the Jenkins instance up to a specified folder depth.
    
        Args:
            folder_depth: The maximum depth of folders to traverse. If None, traverses all levels.
            folder_depth_per_request: The depth of folders to request per API call.
    
        Returns:
            A list of ItemType objects representing the items.
        """
        query = reduce(
            lambda q, _: f'jobs[url,color,name,{q}]',
            range(folder_depth_per_request),
            'jobs',
        )
        response = self.request('GET', rest_endpoint.ITEMS(folder='', query=query))
    
        items = []
    
        item_stack = [(0, [], response.json()['jobs'])]
        for level, path, level_items in item_stack:
            current_items = level_items if isinstance(level_items, list) else [level_items]
    
            for item in current_items:
                job_path = path + [item['name']]
                item.setdefault('fullname', '/'.join(job_path))
                items.append(serialize_item(item))
    
                children = item.get('jobs')
                if isinstance(children, list) and (folder_depth is None or level < folder_depth):
                    item_stack.append((level + 1, job_path, children))
    
        return items
  • REST endpoint definition for ITEMS: '{folder}/api/json?tree={query}' used by get_items to query Jenkins.
    ITEMS = RestEndpoint('{folder}/api/json?tree={query}')
  • MCP server instance (JenkinsMCP) is created at line 30, and item module (containing get_all_items) is imported at line 34 to register tools via the decorator.
    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
Behavior2/5

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

No annotations are provided, and the description only says "Get all items" without disclosing any behavioral traits such as read-only nature, pagination, or performance implications for large datasets.

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 short and front-loaded with the key action. The 'Returns' line adds minimal value, making it slightly less concise than ideal but still acceptable.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool has an output schema and no parameters, the description is mostly adequate. However, it lacks context about potential large result sets or alternative tools for filtering, leaving some gaps for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Input schema has zero parameters with 100% coverage, so the description does not need to add parameter information. Baseline 4 is appropriate as the description offers no further parameter context, which is acceptable here.

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 "Get all items from Jenkins", using a specific verb and resource. It distinguishes itself from siblings like get_item and query_items by asserting it returns all items.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for listing all items, but does not explicitly state when to use this tool versus alternatives like query_items or get_item. No when-not or guidance is provided.

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