Skip to main content
Glama
gkhays
by gkhays

nvd_tool

Retrieve CVE data from the National Vulnerability Database using its ID, enabling AI models to access current vulnerability information for analysis and risk assessment.

Instructions

Fetch CVE data from NVD

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cve_idYesThe CVE ID to fetch data for.

Implementation Reference

  • The handler function for the 'nvd_tool' tool. It extracts the cve_id from arguments, instantiates NVD class, calls get_cve_list(), and returns the data as TextContent or None.
    @mcp.call_tool()
    async def nvd_tool(name: str, arguments: dict) -> Sequence[TextContent | ImageContent | EmbeddedResource]:
        """
        Fetch CVE data from NVD using the provided arguments.
    
        Args:
            cve_id (str): The CVE ID to fetch data for.
        """
        from mcp_nvd.nvd import NVD
        LOGGER.info(f"Fetching CVE data for {name} with arguments: {arguments}")
        cve_id = arguments.get("cve_id")
    
        nvd = NVD(cve_id=cve_id)
        cve_data = nvd.get_cve_list()
    
        if cve_data:
            # return cve_data
            return [TextContent(type="text", text=str(cve_data))]
        else:
            LOGGER.info(f"CVE {cve_id} not found in NVD database.")
            return None
  • Registration of the 'nvd_tool' via the list_tools() callback, which returns the Tool object with name, description, and inputSchema.
    @mcp.list_tools()
    async def list_tools() -> list[types.Tool]:
        LOGGER.debug("Listing tools...")
        tools = [
            types.Tool(
                name="nvd_tool", description="Fetch CVE data from NVD",
                inputSchema={
                    "type": "object",
                    "properties": {
                        "cve_id": {
                            "type": "string",
                            "description": "The CVE ID to fetch data for."
                        }
                    },
                    "required": ["cve_id"]
                },
            )
        ]
        return tools
  • Input schema defining the required 'cve_id' string parameter for the nvd_tool.
    inputSchema={
        "type": "object",
        "properties": {
            "cve_id": {
                "type": "string",
                "description": "The CVE ID to fetch data for."
            }
        },
        "required": ["cve_id"]
    },
  • Helper method in NVD class that performs the actual HTTP request to NVD API to fetch CVE data based on cve_id.
    def get_cve_list(self) -> list:
        """
        Retrieve a specific CVE by its ID.
    
        Args:
            cve_id (str): The CVE ID (e.g. CVE-2025-12345)
        
        Returns:
            dict: CVE item or None if not found
        """
        params = {
            "cveId": self.cve_id,
        }
    
        LOGGER.info(f"Fetching CVE: {self.cve_id}...")
    
        try:
            response = requests.get(self.base_url, params=params)
    
            if response.status_code == 200:
                LOGGER.info(f"Response: {response.status_code}")
                data = response.json()
                vulnerabilities = data.get('vulnerabilities', [])
    
                if vulnerabilities:
                    self.cve_json = vulnerabilities[0]
                    self.description = self.get_description()
                    LOGGER.info(f"Description: {self.description}")
                    return vulnerabilities
                else:
                    LOGGER.info(f"CVE {self.cve_id} not found in NVD database.")
                    return None
                
            elif response.status_code == 403:
                print("Error: API rate limit exceeded. Please try again later.")
                return None
            elif response.status_code == 404:
                print("Error: API endpoint not found. Checking for diagnostic information...")
                print(f"Response: {response.text}")
                print("\nTrying alternative API endpoint...")
            else:
                print(f"Error: API returned status code {response.status_code}")
                print(f"Response: {response.text}")
                return None
    
        except Exception as e:
            print(f"Error: {e}")
            return None
Behavior2/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. 'Fetch CVE data from NVD' implies a read-only operation, but it doesn't specify rate limits, authentication requirements, error conditions, response format, or whether it's idempotent. For a tool with zero annotation coverage, this is insufficient.

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 extremely concise at just four words, front-loading the essential information with zero wasted words. It efficiently communicates the core purpose without unnecessary elaboration.

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

Completeness2/5

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

For a tool with no annotations and no output schema, the description is inadequate. It doesn't explain what 'CVE data' includes, the format of returned information, potential errors, or any behavioral characteristics. The description fails to compensate for the lack of structured metadata.

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?

The schema description coverage is 100%, with the single parameter 'cve_id' fully documented in the schema. The description doesn't add any parameter-specific information beyond what's already in the schema, so the baseline score of 3 is appropriate.

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 'Fetch CVE data from NVD' clearly states the action (fetch) and resource (CVE data from NVD), making the tool's purpose immediately understandable. It doesn't distinguish from siblings, but there are no sibling tools on this server, so a 4 is appropriate rather than a 5.

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, prerequisites, or limitations. It simply states what the tool does without any context about appropriate usage scenarios or constraints.

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

Related 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/gkhays/mcp-nvd-server'

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