Skip to main content
Glama

cpe_lookup

Search Shodan's CVEDB for Common Platform Enumeration entries by product name to identify software and hardware versions and configurations. Supports pagination and count-only results.

Instructions

Search for Common Platform Enumeration (CPE) entries by product name in Shodan's CVEDB. Supports pagination and can return either full CPE details or just the total count. Useful for identifying specific versions and configurations of software and hardware.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
productYesThe name of the product to search for CPEs.
countNoIf true, returns only the count of matching CPEs.
skipNoNumber of CPEs to skip (for pagination).
limitNoMaximum number of CPEs to return (max 1000).

Implementation Reference

  • Main handler for cpe_lookup tool: validates input using CpeLookupArgsSchema, queries CVEDB via queryCPEDB helper, formats results (count or list with pagination), and returns as MCP text content or error.
    case "cpe_lookup": {
      const parsedCpeArgs = CpeLookupArgsSchema.safeParse(args);
      if (!parsedCpeArgs.success) {
        throw new Error("Invalid cpe_lookup arguments");
      }
    
      try {
        const result = await queryCPEDB({
          product: parsedCpeArgs.data.product,
          count: parsedCpeArgs.data.count,
          skip: parsedCpeArgs.data.skip,
          limit: parsedCpeArgs.data.limit
        });
    
        // Format the response based on whether it's a count request or full CPE list
        const formattedResult = parsedCpeArgs.data.count
          ? { total_cpes: result.total }
          : {
              cpes: result.cpes,
              skip: parsedCpeArgs.data.skip,
              limit: parsedCpeArgs.data.limit,
              total_returned: result.cpes.length
            };
    
        return {
          content: [
            {
              type: "text",
              text: JSON.stringify(formattedResult, null, 2),
            },
          ],
        };
      } catch (error: any) {
        return {
          content: [
            {
              type: "text",
              text: error.message,
            },
          ],
          isError: true,
        };
      }
    }
  • Zod schema defining input arguments for cpe_lookup: product name (required), optional count flag, skip and limit for pagination.
    const CpeLookupArgsSchema = z.object({
      product: z.string().describe("The name of the product to search for CPEs."),
      count: z.boolean().optional().default(false).describe("If true, returns only the count of matching CPEs."),
      skip: z.number().optional().default(0).describe("Number of CPEs to skip (for pagination)."),
      limit: z.number().optional().default(1000).describe("Maximum number of CPEs to return (max 1000)."),
    });
  • src/index.ts:336-340 (registration)
    Tool registration in ListToolsRequestHandler: defines name 'cpe_lookup', detailed description, and converts Zod schema to JSON schema for MCP protocol.
    {
      name: "cpe_lookup",
      description: "Search for Common Platform Enumeration (CPE) entries by product name in Shodan's CVEDB. Supports pagination and can return either full CPE details or just the total count. Useful for identifying specific versions and configurations of software and hardware.",
      inputSchema: zodToJsonSchema(CpeLookupArgsSchema),
    },
  • Helper function to query Shodan CVEDB API endpoint /cpes with product and pagination params, logs query, handles 422 validation errors specifically.
    async function queryCPEDB(params: {
      product: string;
      count?: boolean;
      skip?: number;
      limit?: number;
    }) {
      try {
        logToFile(`Querying CVEDB for CPEs with params: ${JSON.stringify(params)}`);
        const response = await axios.get(`${CVEDB_API_URL}/cpes`, { params });
        return response.data;
      } catch (error: any) {
        if (error.response?.status === 422) {
          throw new Error(`Invalid parameters: ${error.response.data?.detail || error.message}`);
        }
        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 mentions pagination support and the ability to return full details or just counts, which adds useful context beyond basic functionality. However, it does not cover aspects like rate limits, authentication needs, error handling, or response format details, leaving gaps in behavioral understanding.

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 three sentences: the first states the core functionality, the second adds key features (pagination and output options), and the third provides usage context. Each sentence earns its place without redundancy, making it front-loaded and appropriately sized for the tool's complexity.

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 (4 parameters, no output schema, no annotations), the description covers core functionality and some behavioral aspects but lacks details on response format, error cases, or integration with sibling tools. It is adequate as a minimum viable description but has clear gaps in providing a complete operational context.

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?

Schema description coverage is 100%, so the schema fully documents all parameters. The description adds value by explaining the purpose ('Search for CPE entries by product name') and the utility ('Useful for identifying specific versions and configurations'), which provides semantic context beyond the schema's technical details. Since no parameters are left undocumented, this exceeds the baseline of 3.

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 ('Search for Common Platform Enumeration entries by product name'), identifies the resource ('in Shodan's CVEDB'), and distinguishes it from siblings by focusing on CPE lookup rather than CVE lookup or other Shodan functions. It explicitly mentions what it returns ('full CPE details or just the total count'), making the purpose unambiguous.

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

Usage Guidelines3/5

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

The description implies usage context ('Useful for identifying specific versions and configurations of software and hardware') but does not explicitly state when to use this tool versus alternatives like 'cve_lookup' or 'cves_by_product'. It mentions pagination and count options, which provide some guidance on functionality, but lacks direct comparisons or exclusions for sibling tools.

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