Skip to main content
Glama

search_cves

Search CVE descriptions by keyword to identify security vulnerabilities and exposures in software or systems.

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 handler function that implements the core logic for the 'search_cves' tool: connects to DB, searches, formats results into JSON with truncated descriptions.
    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, defining parameters keyword (required string) and limit (optional integer).
    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"] } ),
  • The dispatch/registration logic in call_tool handler that maps 'search_cves' tool name to the tool_search_cves function call.
    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 using LIKE.
    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()]

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