get_cwe
Retrieve full details for a specific CWE, including name, description, exploit likelihood, parent CWE, and vulnerability count. Input a CWE ID (e.g., CWE-79) to get comprehensive information.
Instructions
Get details for a specific CWE including full name, description, exploit likelihood, parent CWE, and total vulnerability count. Example: cwe_id='CWE-79' returns details about Cross-Site Scripting.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| cwe_id | Yes | CWE identifier (e.g. 'CWE-79' or '79') |
Implementation Reference
- eip_mcp/server.py:1404-1407 (handler)The main handler function for the 'get_cwe' tool. Validates the CWE ID, calls the API client, and formats the detail response.
def _tool_get_cwe(args: dict[str, Any]) -> str: cwe_id = validators.validate_cwe(args.get("cwe_id", "")) data = api_client.get_cwe(f"CWE-{cwe_id}") return formatters.format_cwe_detail(data) - eip_mcp/server.py:1518-1532 (registration)Registration of 'get_cwe' in the dispatch table, mapping the tool name to its handler function _tool_get_cwe.
_TOOLS_WITH_ARGS: dict[str, Callable[[dict[str, Any]], str]] = { "search_vulnerabilities": _tool_search, "get_vulnerability": _tool_get_vuln, "get_exploit_code": _tool_get_code, "get_exploit_analysis": _tool_get_exploit_analysis, "get_nuclei_templates": _tool_get_nuclei, "search_exploits": _tool_search_exploits, "list_authors": _tool_list_authors, "get_author": _tool_get_author, "get_cwe": _tool_get_cwe, "list_products": _tool_list_products, "lookup_alt_id": _tool_lookup_alt_id, "audit_stack": _tool_audit_stack, "generate_finding": _tool_generate_finding, } - eip_mcp/formatters.py:1283-1305 (helper)Helper formatter that converts the CWE detail API response into user-friendly text output.
def format_cwe_detail(data: dict[str, Any]) -> str: """Format CWE detail.""" lines = [ _UNTRUSTED_NOTICE, "", f"{_sanitize_untrusted_text(data['cwe_id'], max_len=40)}: {_sanitize_untrusted_text(data['name'], max_len=200)}", ] if data.get("short_label"): lines.append(f"Short label: {_safe_inline(data['short_label'], max_len=160)}") if data.get("likelihood"): lines.append(f"Exploit likelihood: {_safe_inline(data['likelihood'], max_len=80)}") lines.append(f"Vulnerabilities: {data.get('vuln_count', 0):,}") parent = data.get("parent_cwe") if parent: parent_id = _sanitize_untrusted_text(parent.get("cwe_id"), max_len=40) parent_name = _sanitize_untrusted_text(parent.get("name"), max_len=120) lines.append(f"Parent: {parent_id} ({parent_name})") if data.get("description"): lines.append(f"\nDescription:\n{_safe_inline(_truncate(data['description'], 550), max_len=650)}") return "\n".join(lines) - eip_mcp/api_client.py:207-210 (helper)API client method that sends an HTTP GET request to the EIP API to fetch CWE details.
def get_cwe(cwe_id: str) -> dict[str, Any]: """Get CWE detail.""" cwe_seg = _safe_path_segment(cwe_id) return _request_json(f"/api/v1/cwe/{cwe_seg}") - eip_mcp/server.py:615-635 (schema)Schema definition for the 'get_cwe' tool including name, description, and input schema (cwe_id with regex pattern validation).
types.Tool( name="get_cwe", annotations=_ro_annotations("Get CWE Detail"), description=( "Get details for a specific CWE including full name, description, exploit " "likelihood, parent CWE, and total vulnerability count. " "Example: cwe_id='CWE-79' returns details about Cross-Site Scripting." ), inputSchema={ "type": "object", "properties": { "cwe_id": { "type": "string", "pattern": _CWE_PATTERN, "maxLength": 12, "description": "CWE identifier (e.g. 'CWE-79' or '79')", }, }, "required": ["cwe_id"], }, ),