Skip to main content
Glama

get_view

Retrieve a Jenkins view by its path, returning jobs and nested sub-views for hierarchical navigation.

Instructions

Get a Jenkins view by path, returning its jobs and/or nested sub-views.

Views can be nested up to multiple levels deep. Use "/" to separate levels in the path. If the view contains sub-views instead of jobs, the response will include their names so you can drill down further.

Args: view_path: View path using "/" to separate levels. Examples: "All", "frontend", "frontend/nightly". Spaces and special characters in view names are handled automatically. depth: Depth of detail to retrieve for each job. Default is 0.

Returns: A dict with the view's name, jobs list, and/or nested views.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
view_pathYes
depthNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The tool handler function for 'get_view'. It is an async function decorated with @mcp.tool(tags=['read']) that takes ctx, view_path, and depth parameters, and delegates to the Jenkins REST client.
    @mcp.tool(tags=['read'])
    async def get_view(ctx: Context, view_path: str, depth: int = 0) -> dict:
        """Get a Jenkins view by path, returning its jobs and/or nested sub-views.
    
        Views can be nested up to multiple levels deep. Use "/" to separate levels
        in the path. If the view contains sub-views instead of jobs, the response
        will include their names so you can drill down further.
    
        Args:
            view_path: View path using "/" to separate levels.
                       Examples: "All", "frontend", "frontend/nightly".
                       Spaces and special characters in view names are handled automatically.
            depth: Depth of detail to retrieve for each job. Default is 0.
    
        Returns:
            A dict with the view's name, jobs list, and/or nested views.
        """
        return jenkins(ctx).get_view(view_path=view_path, depth=depth)
  • The REST endpoint definition for VIEW: '{view_path}/api/json?depth={depth}', which is constructed dynamically with view_path and depth parameters.
    VIEW = RestEndpoint('{view_path}/api/json?depth={depth}')
  • Tool registration via the @mcp.tool(tags=['read']) decorator on the get_view async function. The 'view' module is imported in server/__init__.py line 34 to register all tools.
    @mcp.tool(tags=['read'])
    async def get_view(ctx: Context, view_path: str, depth: int = 0) -> dict:
        """Get a Jenkins view by path, returning its jobs and/or nested sub-views.
    
        Views can be nested up to multiple levels deep. Use "/" to separate levels
        in the path. If the view contains sub-views instead of jobs, the response
        will include their names so you can drill down further.
    
        Args:
            view_path: View path using "/" to separate levels.
                       Examples: "All", "frontend", "frontend/nightly".
                       Spaces and special characters in view names are handled automatically.
            depth: Depth of detail to retrieve for each job. Default is 0.
    
        Returns:
            A dict with the view's name, jobs list, and/or nested views.
        """
        return jenkins(ctx).get_view(view_path=view_path, depth=depth)
  • Helper method _build_view_path that converts a slash-separated view path (e.g., 'frontend/nightly') into the Jenkins URL path format (e.g., 'view/frontend/view/nightly').
    def _build_view_path(self, view_path: str) -> str:
        """Build a Jenkins view URL path from a slash-separated view path.
    
        Args:
            view_path: Slash-separated view path (e.g. "frontend/nightly").
    
        Returns:
            The Jenkins URL path segment (e.g. "view/frontend/view/nightly").
        """
        from urllib.parse import quote
    
        parts = [quote(p.strip(), safe='') for p in view_path.split('/') if p.strip()]
        return '/'.join(f'view/{p}' for p in parts)
  • The Jenkins REST client get_view method that constructs the URL path via _build_view_path, makes an HTTP GET request using the VIEW endpoint, and returns the JSON response.
    def get_view(self, *, view_path: str, depth: int = 0) -> dict:
        """Get a specific view by path.
    
        Supports nested views using slash-separated paths
        (e.g. "All", "frontend/nightly", "frontend/nightly/nightly linux").
    
        Args:
            view_path: Slash-separated view path.
            depth: The depth of the information to retrieve.
    
        Returns:
            A dictionary with the view's name, jobs, and/or nested views.
        """
        url_path = self._build_view_path(view_path)
        response = self.request('GET', rest_endpoint.VIEW(view_path=url_path, depth=depth))
        return response.json()
Behavior4/5

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

With no annotations, the description discloses the return shape (dict with name, jobs, nested views) and how nesting works. It does not mention authorization or side effects, but as a getter, the behavior is transparent enough.

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

Conciseness5/5

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

The description is well-organized: a brief summary, nesting explanation, parameter docs with examples, and return type. No unnecessary text, every sentence earns its place.

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

Completeness5/5

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

Given only two parameters, no nested objects, and an output schema present, the description covers all necessary aspects: path format, nesting, parameter details, and return value. No gaps.

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?

Since schema description coverage is 0%, the description adds significant detail for view_path (examples, special character handling) and depth (purpose, default). Adds value beyond the schema.

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 that the tool retrieves a Jenkins view by path and returns its jobs and/or nested sub-views. It distinguishes from siblings like get_all_views and get_item by focusing on a specific view and its hierarchical structure.

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

Usage Guidelines4/5

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

The description provides explicit guidance on how to construct the view path using '/' and gives examples. It does not explicitly state when not to use this tool or contrast with siblings, but the usage context is clear.

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