Skip to main content
Glama

query_for_cve_affected

Query the OSV database to identify which software versions are affected by a specific CVE, returning a list of impacted versions for security assessment.

Instructions

Query the OSV database for a CVE and return the affected versions.

Args:
    cve: The CVE ID to query

Returns:
    A list of affected versions

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
cveYes

Implementation Reference

  • MCP tool registration and handler for 'query_for_cve_affected'. Defines input schema via docstring and type hint (cve: str), instantiates OSVServer, and delegates to its query_for_cve_affected method.
    @mcp.tool()
    def query_for_cve_affected(cve: str):
        """
        Query the OSV database for a CVE and return the affected versions.
    
        Args:
            cve: The CVE ID to query
    
        Returns:
            A list of affected versions
        """
        osv = OSVServer()
        return osv.query_for_cve_affected(cve)
  • Core handler logic within OSVServer class: queries OSV API for the CVE and parses the affected versions using helper methods.
    def query_for_cve_affected(self, cve: str):
        """
        Query the OSV database for a CVE and return the affected versions.
        """
        data = self._query_cve(cve)
        versions = self._parse_versions(data)
        return versions
  • Helper method to query the OSV API endpoint for a specific CVE ID.
    def _query_cve(self, cve: str):
        """
        Query the OSV database for a CVE.
        """
        url = self.cve_url.format(cve_id=cve)
        response = requests.get(url)
        return response.json()
  • Helper method to parse affected version strings from the OSV response JSON.
    def _parse_versions(self, data: dict):
        """
        Parse version strings from the OSV response.
        Extracts versions from the 'versions' array in the affected package data.
        
        Args:
            data: The full OSV response JSON data
            
        Returns:
            List of version strings
        """
        versions = []
        if 'affected' in data:
            for affected in data['affected']:
                if 'versions' in affected:
                    versions.extend(affected['versions'])
                    versions = list(set(versions))
        return versions
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 states the basic operation but lacks critical details: it doesn't mention error handling (e.g., what happens if the CVE isn't found), rate limits, authentication needs, or data freshness. For a query tool with zero annotation coverage, this leaves significant gaps in understanding its behavior.

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 well-structured and concise: a clear purpose statement followed by 'Args' and 'Returns' sections. Every sentence adds value without redundancy, and it's front-loaded with the core functionality. The brevity is appropriate for a simple query tool.

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 low complexity (one parameter, no output schema, no annotations), the description is minimally complete. It covers the basic purpose and parameter semantics but lacks behavioral details and usage guidelines. Without an output schema, it hints at the return type ('A list of affected versions') but doesn't specify the structure (e.g., version ranges, packages). This is adequate but has clear gaps.

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

Parameters4/5

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

The description adds meaningful context for the single parameter: it explains that 'cve' is 'The CVE ID to query,' which clarifies the expected format beyond the schema's basic 'string' type. With 0% schema description coverage and only one parameter, this adequately compensates, though it could specify format examples (e.g., 'CVE-2021-12345').

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: 'Query the OSV database for a CVE and return the affected versions.' This specifies the verb ('query'), resource ('OSV database'), and outcome ('return the affected versions'). However, it doesn't explicitly differentiate from sibling tools like 'query_for_cve_fix_versions' or 'query_package_cve', which prevents a perfect score.

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. With sibling tools like 'query_for_cve_fix_versions' (which likely returns fix versions) and 'query_package_cve' (which might query by package), there's no indication of when this specific CVE-affected-versions query is appropriate. The minimal context ('Query the OSV database for a CVE') is insufficient for distinguishing use cases.

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/EdenYavin/OSV-MCP'

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