Skip to main content
Glama
ZeroPathAI

ZeroPath MCP Server

Official
by ZeroPathAI

get_issue

Retrieve a specific vulnerability issue by its ID to access detailed information and available patch data for security analysis.

Instructions

Get a specific vulnerability issue by its ID, including patch information if available.

Args:
    issue_id (str): The ID of the issue to retrieve

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
issue_idYes

Implementation Reference

  • The @mcp.tool() decorated function that implements the get_issue tool logic. It fetches the issue from the ZeroPath API and formats the response using process_issue_response.
    @mcp.tool()
    def get_issue(issue_id):
        """
        Get a specific vulnerability issue by its ID, including patch information if available.
    
        Args:
            issue_id (str): The ID of the issue to retrieve
        """
        if not issue_id:
            return "Error: Issue ID is required"
    
        response, error = make_api_request("issues/get", {"issueId": issue_id})
    
        if error:
            return error
    
        if response.status_code == 200:
            raw_response = response.json()
            if not raw_response:
                return "Error: Empty response received from API"
            return process_issue_response(raw_response)
        elif response.status_code == 401:
            return "Error: Unauthorized - check API credentials"
        elif response.status_code == 400:
            return f"Error: Bad request - {response.text}"
        else:
            return f"Error: API returned status {response.status_code}: {response.text}"
  • Supporting function that formats the raw API response for a single issue into a human-readable string, including details, vulnerable code, and patch information if available. Called by get_issue.
    def process_issue_response(issue):
        """
        Process a single issue response into a readable format, focusing on the issue details and patch.
        """
        if not issue:
            return "Error: Empty issue data"
    
        if "error" in issue and issue["error"]:
            return f"Error: {issue['error']}"
    
        # Check if we have a valid issue (must have an id at minimum)
        if not issue.get('id'):
            return "Error: Invalid issue data received - missing ID"
    
        # Get patch information if available
        patch = issue.get("patch") or issue.get("vulnerabilityPatch")
    
        result = "Issue Details:\n"
    
        result += f"ID: {issue.get('id', 'N/A')}\n"
        result += f"Status: {issue.get('status', 'N/A')}\n"
        result += f"Title: {issue.get('generatedTitle', 'N/A')}\n"
        result += f"Description: {issue.get('generatedDescription', 'N/A')}\n"
        result += f"Language: {issue.get('language', 'N/A')}\n"
        result += f"Vulnerability Class: {issue.get('vulnClass', 'N/A')}\n"
    
        if issue.get("cwes"):
            result += f"CWEs: {', '.join(issue.get('cwes', []))}\n"
    
        result += f"Severity: {issue.get('severity', 'N/A')}\n"
        result += f"Affected File: {issue.get('affectedFile', 'N/A')}\n"
    
        if issue.get("startLine") and issue.get("endLine"):
            result += f"Location: Lines {issue.get('startLine')} to {issue.get('endLine')}\n"
    
        result += f"Validation Status: {issue.get('validated', 'N/A')}\n"
        result += f"Unpatchable: {issue.get('unpatchable', False)}\n"
        result += f"Triage Phase: {issue.get('triagePhase', 'N/A')}\n"
    
        # Add code segment if available
        if issue.get("sastCodeSegment"):
            result += "\nVulnerable Code Segment:\n"
            result += f"```\n{issue.get('sastCodeSegment')}\n```\n"
    
        # Add patch information if available
        if patch and not issue.get("unpatchable", False):
            result += "\n========== PATCH INFORMATION ==========\n"
            result += f"PR Link: {patch.get('prLink', 'N/A')}\n"
            result += f"PR Title: {patch.get('prTitle', 'N/A')}\n"
            result += f"PR Description: {patch.get('prDescription', 'N/A')}\n"
            result += f"PR Status: {patch.get('pullRequestStatus', 'N/A')}\n"
            result += f"Validation Status: {patch.get('validated', 'N/A')}\n"
            result += f"Created At: {patch.get('createdAt', 'N/A')}\n"
            result += f"Updated At: {patch.get('updatedAt', 'N/A')}\n"
    
            # Add git diff if available
            if patch.get("gitDiff"):
                result += "\n========== PATCH ID & GIT DIFF ==========\n"
                result += f"PATCH ID: {patch.get('id', 'N/A')}\n"
                result += "========================================\n"
                result += "Git Diff:\n"
                result += f"```diff\n{patch.get('gitDiff')}\n```\n"
    
        return result
  • The @mcp.tool() decorator registers the get_issue function as an MCP tool.
    @mcp.tool()
  • General helper function used by get_issue to make authenticated POST requests to the ZeroPath API endpoints.
    def make_api_request(endpoint, payload=None, include_org=True):
        """Make authenticated API request to ZeroPath."""
        if not token_id or not token_secret:
            return None, "Error: Zeropath API credentials not found in environment variables"
    
        headers = {
            "X-ZeroPath-API-Token-Id": token_id,
            "X-ZeroPath-API-Token-Secret": token_secret,
            "Content-Type": "application/json"
        }
    
        if payload is None:
            payload = {}
    
        if include_org and org_id:
            payload["organizationId"] = org_id
    
        try:
            response = requests.post(
                f"{API_BASE_URL}/{endpoint}",
                headers=headers,
                json=payload
            )
            return response, None
        except Exception as e:
            return None, f"Error: {str(e)}"

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/ZeroPathAI/zeropath-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server