list_cwes
Retrieve the most common vulnerability types ranked by CVE count, including CWE IDs, names, exploit likelihood, and weakness labels.
Instructions
List CWE (Common Weakness Enumeration) categories ranked by vulnerability count. Returns CWE IDs, names, short labels, exploit likelihood, and how many CVEs have that weakness. Use this when asked 'what are the most common vulnerability types?'
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- eip_mcp/server.py:1399-1401 (handler)The handler function _tool_list_cwes() that executes the tool logic for 'list_cwes'. It calls api_client.list_cwes() and formats the result via formatters.format_cwe_list().
def _tool_list_cwes() -> str: data = api_client.list_cwes() return formatters.format_cwe_list(data) - eip_mcp/server.py:605-613 (schema)The tool registration in the TOOLS list with the name 'list_cwes', its description ('List CWE Categories'), and input schema (empty object - no parameters).
types.Tool( name="list_cwes", annotations=_ro_annotations("List CWE Categories"), description=( "List CWE (Common Weakness Enumeration) categories ranked by vulnerability count. " "Returns CWE IDs, names, short labels, exploit likelihood, and how many CVEs " "have that weakness. Use this when asked 'what are the most common vulnerability types?'" ), inputSchema={"type": "object", "properties": {}}, - eip_mcp/server.py:1534-1538 (registration)The dispatch table entry mapping 'list_cwes' to the _tool_list_cwes handler in the _TOOLS_NO_ARGS dict.
_TOOLS_NO_ARGS: dict[str, Callable[[], str]] = { "get_platform_stats": _tool_stats, "check_health": _tool_health, "list_cwes": _tool_list_cwes, "list_vendors": _tool_list_vendors, - eip_mcp/api_client.py:202-204 (helper)The API client method list_cwes() that makes the HTTP GET request to /api/v1/cwe endpoint to fetch CWE data.
def list_cwes() -> dict[str, Any]: """List CWE categories with vuln counts.""" return _request_json("/api/v1/cwe") - eip_mcp/formatters.py:1261-1280 (helper)The format_cwe_list() function that formats the CWE API response into human-readable text for the AI assistant.
def format_cwe_list(data: dict[str, Any]) -> str: """Format CWE index.""" items = data.get("items", []) if not items: return "No CWE data available." lines = [ _UNTRUSTED_NOTICE, "", f"CWE Categories ({data.get('total', len(items))} with vulnerabilities):\n", ] for c in items[:30]: name = _sanitize_untrusted_text(c.get("short_label") or c.get("name", "?"), max_len=120) label = name if len(name) <= 50 else name[:47] + "..." lines.append(f" {c['cwe_id']:>8} {c['vuln_count']:>6} vulns {label}") if len(items) > 30: lines.append(f" ... and {len(items) - 30} more") return "\n".join(lines)