Skip to main content
Glama

cve_lookup

Query detailed CVE information including CVSS scores, EPSS probability, KEV status, mitigations, ransomware associations, and affected products from Shodan's vulnerability database.

Instructions

Query detailed vulnerability information from Shodan's CVEDB. Returns comprehensive CVE details including CVSS scores (v2/v3), EPSS probability and ranking, KEV status, proposed mitigations, ransomware associations, and affected products (CPEs).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cveYesThe CVE identifier to query (format: CVE-YYYY-NNNNN).

Implementation Reference

  • The main execution handler for the 'cve_lookup' tool. Parses input arguments using CVELookupArgsSchema, queries the CVEDB API via queryCVEDB helper, formats the CVE response with severity calculations and structured output, handles errors, and returns formatted JSON content.
    case "cve_lookup": {
      const parsedCveArgs = CVELookupArgsSchema.safeParse(args);
      if (!parsedCveArgs.success) {
        throw new Error("Invalid CVE format. Please use format: CVE-YYYY-NNNNN (e.g., CVE-2021-44228)");
      }
    
      const cveId = parsedCveArgs.data.cve.toUpperCase();
      logToFile(`Looking up CVE: ${cveId}`);
      
      try {
        const result = await queryCVEDB(cveId);
    
        // Helper function to format CVSS score severity
        const getCvssSeverity = (score: number) => {
          if (score >= 9.0) return "Critical";
          if (score >= 7.0) return "High";
          if (score >= 4.0) return "Medium";
          if (score >= 0.1) return "Low";
          return "None";
        };
    
        // Format the response in a user-friendly way
        const formattedResult = {
          "Basic Information": {
            "CVE ID": result.cve_id,
            "Published": new Date(result.published_time).toLocaleString(),
            "Summary": result.summary
          },
          "Severity Scores": {
            "CVSS v3": result.cvss_v3 ? {
              "Score": result.cvss_v3,
              "Severity": getCvssSeverity(result.cvss_v3)
            } : "Not available",
            "CVSS v2": result.cvss_v2 ? {
              "Score": result.cvss_v2,
              "Severity": getCvssSeverity(result.cvss_v2)
            } : "Not available",
            "EPSS": result.epss ? {
              "Score": `${(result.epss * 100).toFixed(2)}%`,
              "Ranking": `Top ${(result.ranking_epss * 100).toFixed(2)}%`
            } : "Not available"
          },
          "Impact Assessment": {
            "Known Exploited Vulnerability": result.kev ? "Yes" : "No",
            "Proposed Action": result.propose_action || "No specific action proposed",
            "Ransomware Campaign": result.ransomware_campaign || "No known ransomware campaigns"
          },
          "Affected Products": result.cpes?.length > 0 ? result.cpes : ["No specific products listed"],
          "Additional Information": {
            "References": result.references?.length > 0 ? result.references : ["No references provided"]
          }
        };
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(formattedResult, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: error.message,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema definition for input validation of the cve_lookup tool, enforcing CVE ID format.
    const CVELookupArgsSchema = z.object({
      cve: z.string()
        .regex(/^CVE-\d{4}-\d{4,}$/i, "Must be a valid CVE ID format (e.g., CVE-2021-44228)")
        .describe("The CVE identifier to query (format: CVE-YYYY-NNNNN)."),
    });
  • src/index.ts:326-330 (registration)
    Tool registration in the ListToolsRequest handler, defining name, description, and input schema for cve_lookup.
    {
      name: "cve_lookup",
      description: "Query detailed vulnerability information from Shodan's CVEDB. Returns comprehensive CVE details including CVSS scores (v2/v3), EPSS probability and ranking, KEV status, proposed mitigations, ransomware associations, and affected products (CPEs).",
      inputSchema: zodToJsonSchema(CVELookupArgsSchema),
    },
  • Helper function that performs the actual API call to Shodan's CVEDB for a specific CVE ID, handles specific HTTP errors, and returns the raw response data used by the handler.
    // Helper Function for CVE lookups using CVEDB
    async function queryCVEDB(cveId: string) {
      try {
        logToFile(`Querying CVEDB for: ${cveId}`);
        const response = await axios.get(`${CVEDB_API_URL}/cve/${cveId}`);
        return response.data;
      } catch (error: any) {
        if (error.response?.status === 422) {
          throw new Error(`Invalid CVE ID format: ${cveId}`);
        }
        if (error.response?.status === 404) {
          throw new Error(`CVE not found: ${cveId}`);
        }
        throw new Error(`CVEDB API error: ${error.message}`);
      }
    }
Behavior3/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It describes the comprehensive data returned (CVSS scores, EPSS, KEV status, etc.), which adds useful context about output behavior, but does not mention rate limits, authentication needs, or error handling, leaving gaps for a tool with external API dependencies.

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 efficiently structured in two sentences: the first states the purpose and source, and the second enumerates the returned details. Every sentence adds essential information with no wasted words, making it highly concise and front-loaded.

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

Completeness4/5

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

Given the tool's complexity (querying external vulnerability data) and lack of annotations and output schema, the description does well by detailing the comprehensive return data. However, it could improve by mentioning response format or error scenarios, slightly limiting completeness for an API-dependent tool.

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 the single parameter 'cve' well-documented in the schema. The description does not add any parameter-specific details beyond what the schema provides, such as examples or edge cases, so it meets the baseline for high schema coverage without extra value.

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

Purpose5/5

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

The description clearly states the specific action ('Query detailed vulnerability information') and resource ('from Shodan's CVEDB'), distinguishing it from sibling tools like cpe_lookup or cves_by_product by focusing on individual CVE details rather than product-based queries or broader searches.

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

Usage Guidelines4/5

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

The description implies usage context by specifying it queries 'detailed vulnerability information' for a CVE identifier, but does not explicitly state when to use this tool versus alternatives like cves_by_product or shodan_search. It provides clear intent but lacks explicit comparison or exclusion guidance.

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/BurtTheCoder/mcp-shodan'

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