Skip to main content
Glama
davidculver

CVE MCP Server

by davidculver

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()]
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden of behavioral disclosure. It mentions searching by keyword but doesn't describe critical behaviors such as response format, pagination, error handling, rate limits, or authentication requirements. This is a significant gap for a search tool with no structured safety or operational hints.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste. It is front-loaded and appropriately sized for a simple search tool, making it easy for an agent to parse quickly.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's moderate complexity (search with two parameters) and lack of annotations or output schema, the description is minimally adequate. It covers the basic purpose but fails to address behavioral aspects like result format or error conditions, leaving gaps that could hinder correct tool invocation by an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with clear documentation for both parameters ('keyword' and 'limit'). The description adds minimal value beyond the schema, as it only reiterates that searching is by keyword in descriptions without providing additional syntax, examples, or constraints. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose with a specific verb ('Search') and resource ('CVEs'), specifying it searches by keyword in descriptions. It distinguishes from sibling 'get_cve_details' (which likely retrieves specific CVE details) and 'get_statistics' (which likely provides aggregated data), though it doesn't explicitly mention these distinctions.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives like 'get_cve_details' or 'get_statistics'. It lacks context about use cases, prerequisites, or exclusions, leaving the agent to infer usage based on tool names alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

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