Skip to main content
Glama

Dependency Auditor

audit_dependencies

Audit npm and PyPI packages for known security vulnerabilities using the OSV database. Analyze package.json or requirements.txt files to identify CVEs and assess risk levels.

Instructions

Audit npm and PyPI packages for known CVEs using the OSV database (GitHub Dependabot's source). Pass packages directly or paste package.json / requirements.txt content.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packagesNoPackages to audit
manifestNoRaw package.json or requirements.txt
manifestTypeNoauto
includeDevDependenciesNo
minSeverityNoLOW

Implementation Reference

  • The handler function processes package information or manifest files, queries the OSV database, and returns vulnerability details.
    async function handler(input: Input) {
      // Build package list
      let packages: PackageInput[] = input.packages || [];
    
      if (input.manifest) {
        const fromManifest = detectAndParse(input.manifest, input.manifestType, input.includeDevDependencies);
        packages = [...packages, ...fromManifest];
      }
    
      if (packages.length === 0) {
        return { error: "No packages provided. Supply 'packages' array or 'manifest' content." };
      }
    
      // Deduplicate
      const seen = new Set<string>();
      packages = packages.filter((p) => {
        const key = `${p.ecosystem}:${p.name}:${p.version || "*"}`;
        if (seen.has(key)) return false;
        seen.add(key);
        return true;
      });
    
      // Query OSV for each package (sequential to be polite to the API)
      const results = await Promise.all(packages.map(async (pkg) => {
        const vulns = await queryPackage(pkg);
        return { pkg, vulns };
      }));
    
      const minSeverityRank = severityRank(input.minSeverity);
    
      const vulnerable: Array<{
        package: string;
        version?: string;
        ecosystem: string;
        vulnerabilities: Array<{
          id: string;
          cves: string[];
          summary: string;
          severity: string;
          fixedIn: string[];
          published?: string;
          url: string;
          cweIds?: string[];
        }>;
        highestSeverity: string;
      }> = [];
      const clean: string[] = [];
      const bySeverity: Record<string, number> = {};
    
      for (const { pkg, vulns } of results) {
        if (vulns.length === 0) {
          clean.push(`${pkg.name}${pkg.version ? `@${pkg.version}` : ""}`);
          continue;
        }
    
        const filtered = vulns
          .map((v) => ({
            id: v.id,
            cves: (v.aliases || []).filter((a) => a.startsWith("CVE-")),
            summary: v.summary || "No summary available",
            severity: getSeverity(v),
            fixedIn: getFixedVersions(v, pkg.ecosystem),
            published: v.published,
            url: getAdvisoryUrl(v),
            cweIds: v.database_specific?.cwe_ids,
          }))
          .filter((v) => severityRank(v.severity) >= minSeverityRank);
    
        if (filtered.length === 0) {
          clean.push(`${pkg.name}${pkg.version ? `@${pkg.version}` : ""}`);
          continue;
        }
    
        // Count by severity
        for (const v of filtered) {
          bySeverity[v.severity] = (bySeverity[v.severity] || 0) + 1;
        }
    
        vulnerable.push({
          package: pkg.name,
          version: pkg.version,
          ecosystem: pkg.ecosystem,
          vulnerabilities: filtered,
          highestSeverity: highestSeverity(filtered.map((v) => v.severity)),
        });
      }
    
      // Sort vulnerable packages by highest severity desc
      vulnerable.sort((a, b) => severityRank(b.highestSeverity) - severityRank(a.highestSeverity));
    
      const totalVulnerabilities = vulnerable.reduce((sum, p) => sum + p.vulnerabilities.length, 0);
    
      return {
        vulnerable,
        clean,
        summary: {
          totalPackages: packages.length,
          vulnerablePackages: vulnerable.length,
          cleanPackages: clean.length,
          totalVulnerabilities,
          bySeverity,
          riskLevel: vulnerable.some((p) => p.highestSeverity === "CRITICAL")
            ? "CRITICAL"
            : vulnerable.some((p) => p.highestSeverity === "HIGH")
            ? "HIGH"
            : vulnerable.length > 0
            ? "MODERATE"
            : "NONE",
        },
      };
    }
  • Input schema definition using Zod for the dependency auditor tool.
    const inputSchema = z.object({
      packages: z
        .array(packageSchema)
        .min(1)
        .max(50)
        .optional()
        .describe("List of packages to audit"),
      manifest: z
        .string()
        .optional()
        .describe("Raw package.json or requirements.txt content. Parsed automatically."),
      manifestType: z
        .enum(["package.json", "requirements.txt", "auto"])
        .default("auto")
        .describe("Manifest format. 'auto' detects from content."),
      includeDevDependencies: z
        .boolean()
        .default(true)
        .describe("Include devDependencies when parsing package.json"),
      minSeverity: z
        .enum(["LOW", "MODERATE", "HIGH", "CRITICAL"])
        .default("LOW")
        .describe("Minimum severity to include in results"),
    });
  • Tool registration for 'dependency-auditor'. Note: mcp-server/src/index.ts registers this tool as 'audit_dependencies'.
    const dependencyAuditorTool: ToolDefinition<Input> = {
      name: "dependency-auditor",
      description:
        "Audit npm and PyPI packages for known security vulnerabilities using the OSV (Open Source Vulnerabilities) database. " +
        "Accepts a list of packages with versions, or paste raw package.json / requirements.txt content for automatic parsing. " +
        "Returns per-package vulnerability details: CVE IDs, severity (CRITICAL/HIGH/MODERATE/LOW), fixed versions, and advisory links. " +
        "Results are sorted by severity. Powered by osv.dev — the same database used by GitHub Dependabot.",
      version: "1.0.0",
      inputSchema,
      handler,
      metadata: {
        tags: ["security", "vulnerabilities", "npm", "pypi", "cve", "dependencies", "devtools"],
        pricing: "$0.005 per call",
        exampleInput: {
          packages: [
            { name: "lodash", version: "4.17.11", ecosystem: "npm" },
            { name: "axios", version: "0.21.0", ecosystem: "npm" },
            { name: "express", version: "4.18.0", ecosystem: "npm" },
          ],
          minSeverity: "MODERATE",
          manifestType: "auto",
          includeDevDependencies: true,
        },
      },
    };
    
    registerTool(dependencyAuditorTool);
Behavior3/5

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

With no annotations provided, the description carries the full disclosure burden. It successfully identifies the authoritative data source ('OSV database'), but omits critical behavioral context: whether the operation is read-only, what the return format contains (list of CVEs? severity scores?), or any rate limiting considerations.

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 consists of two efficient sentences with zero redundancy. The first establishes purpose and data provenance; the second addresses input flexibility. Every word earns its place with no filler content.

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 absence of an output schema and annotations, combined with 40% schema coverage, the description adequately covers the core auditing capability but leaves significant gaps regarding output structure, parameter interdependencies, and the meaning of specific severity levels.

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 coverage is low at 40%, requiring the description to compensate. It maps the two primary input modes (packages array vs. manifest string) and implicitly references manifestType by listing file extensions, but provides no semantic guidance for includeDevDependencies or minSeverity, leaving half the parameter surface undocumented.

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 provides a specific verb ('Audit'), clear resource scope ('npm and PyPI packages'), and distinct output ('known CVEs'). It effectively distinguishes itself from unrelated siblings like stock_thesis or extract_contract_clauses by specifying the security/domain focus.

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 identifies two input methods ('Pass packages directly or paste...'), which hints at the packages vs. manifest parameters. However, it fails to clarify whether these inputs are mutually exclusive or additive, and provides no guidance on when to use the filtering options (minSeverity, includeDevDependencies).

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/marras0914/agent-toolbelt'

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