Skip to main content
Glama
jamiesonio

DefectDojo MCP Server

by jamiesonio

create_finding

Generate and manage findings in DefectDojo by specifying title, test ID, severity, and description to streamline vulnerability tracking and resolution.

Instructions

Create a new finding

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cvssv3No
cweNo
descriptionYes
impactNo
mitigationNo
severityYes
steps_to_reproduceNo
test_idYes
titleYes

Implementation Reference

  • The main handler function for the 'create_finding' tool. It validates inputs, constructs the data payload, calls the DefectDojo client to create the finding, and returns the result.
    async def create_finding(title: str, test_id: int, severity: str, description: str,
                            cwe: Optional[int] = None, cvssv3: Optional[str] = None,
                            mitigation: Optional[str] = None, impact: Optional[str] = None,
                            steps_to_reproduce: Optional[str] = None) -> Dict[str, Any]:
        """Create a new finding.
    
        Args:
            title: Title of the finding
            test_id: ID of the test to associate the finding with
            severity: Severity level (Critical, High, Medium, Low, Info)
            description: Description of the finding
            cwe: Optional CWE identifier
            cvssv3: Optional CVSS v3 score string
            mitigation: Optional mitigation steps
            impact: Optional impact description
            steps_to_reproduce: Optional steps to reproduce
    
        Returns:
            Dictionary with status and data/error
        """
        # Validate severity (case-insensitive check, but send capitalized)
        valid_severities = ["critical", "high", "medium", "low", "info"]
        normalized_severity = severity.lower()
        if normalized_severity not in valid_severities:
            # Use title case for user-facing error message
            valid_display = [s.title() for s in valid_severities]
            return {"status": "error", "error": f"Invalid severity '{severity}'. Must be one of: {', '.join(valid_display)}"}
    
        # Use title case for API
        api_severity = severity.title()
    
        data = {
            "title": title,
            "test": test_id,
            "severity": api_severity,
            "description": description,
            # Set defaults expected by API if not provided explicitly by user?
            # e.g., "active": True, "verified": False? Check API docs.
            "active": True,
            "verified": False,
        }
    
        # Add optional fields if provided
        if cwe is not None:
            data["cwe"] = cwe
        if cvssv3:
            data["cvssv3"] = cvssv3 # Assuming API accepts the string directly
        if mitigation:
            data["mitigation"] = mitigation
        if impact:
            data["impact"] = impact
        if steps_to_reproduce:
            data["steps_to_reproduce"] = steps_to_reproduce
    
        client = get_client()
        result = await client.create_finding(data)
    
        if "error" in result:
            return {"status": "error", "error": result["error"], "details": result.get("details", "")}
    
        return {"status": "success", "data": result}
  • Registers the 'create_finding' tool with the FastMCP server instance, importing the handler from findings_tools.py.
    mcp.tool(
        name="create_finding",
        description="Create a new finding"
    )(create_finding)
  • The DefectDojoClient method called by the tool handler to perform the actual API POST request to create a finding.
    async def create_finding(self, data: Dict[str, Any]) -> Dict[str, Any]:
        """Create a new finding."""
        return await self._request("POST", "/api/v2/findings/", json=data)
  • Alternative registration of the 'create_finding' tool within the findings_tools module's register_tools function.
    mcp.tool(name="create_finding", description="Create a new finding")(create_finding)
  • Input schema defined by the function type hints and docstring parameters for the create_finding tool.
    async def create_finding(title: str, test_id: int, severity: str, description: str,
                            cwe: Optional[int] = None, cvssv3: Optional[str] = None,
                            mitigation: Optional[str] = None, impact: Optional[str] = None,
                            steps_to_reproduce: Optional[str] = None) -> Dict[str, Any]:
Install Server

Other Tools

Related 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/jamiesonio/defectdojo-mcp'

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