Skip to main content
Glama

search_cves

Search Common Vulnerabilities and Exposures (CVEs) by keyword in their descriptions to identify relevant security vulnerabilities.

Instructions

Search CVEs by keyword in description

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
keywordYesSearch term to look for in CVE descriptions
limitNoMaximum number of results (default: 10, max: 50)

Implementation Reference

  • The main handler function for the 'search_cves' tool. It connects to the database, calls the search_cves helper, formats the results, and returns JSON.
    def tool_search_cves(keyword: str, limit: int = 10) -> str: # TODO: switch to FTS5 for better search performance conn = get_connection() limit = min(max(1, limit), 50) results = search_cves(conn, keyword.strip(), limit) # tried to sort by CVSS score but too slow on large datasets # results.sort(key=lambda x: x.get('cvss_score') or 0, reverse=True) formatted = [] for cve in results: desc = cve['description'] if len(desc) > 300: desc = desc[:300] + "..." formatted.append({ "cve_id": cve['cve_id'], "severity": cve['severity'], "cvss_score": cve['cvss_score'], "description": desc, "published_date": cve['published_date'] }) return json.dumps({"query": keyword, "count": len(formatted), "results": formatted}, indent=2)
  • The input schema definition for the 'search_cves' tool, registered in list_tools().
    Tool( name="search_cves", description="Search CVEs by keyword in description", inputSchema={ "type": "object", "properties": { "keyword": { "type": "string", "description": "Search term to look for in CVE descriptions" }, "limit": { "type": "integer", "description": "Maximum number of results (default: 10, max: 50)", "default": 10 } }, "required": ["keyword"] } ),
  • Tool dispatch/registration in the call_tool handler, which invokes tool_search_cves.
    elif name == "search_cves": result = tool_search_cves( arguments.get("keyword", ""), arguments.get("limit", 10) )
  • Database helper function that performs the SQL query to search CVEs by keyword in description.
    def search_cves(conn: sqlite3.Connection, keyword: str, limit: int = 10) -> list[dict]: cursor = conn.execute( "SELECT * FROM cves WHERE description LIKE ? LIMIT ?", (f"%{keyword}%", limit) ) return [dict(row) for row in cursor.fetchall()]
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/davidculver/cve-mcp-server'

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