Skip to main content
Glama

sbom

Generate a Software Bill of Materials (SBOM) for an npm project to document dependencies. Choose between CycloneDX and SPDX formats, and optionally include only production dependencies.

Instructions

Generate a Software Bill of Materials (SBOM) for a project

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the package directory
formatNoSBOM format (default: cyclonedx)
productionNoOnly include production dependencies

Implementation Reference

  • Handler function for the 'sbom' tool. Runs `npm sbom` with optional --sbom-format and --omit=dev flags, returns stdout or error.
    async ({ path, format, production }) => {
      const args = ["sbom"];
      if (format) args.push(`--sbom-format=${format}`);
      if (production) args.push("--omit=dev");
      try {
        const { stdout } = await run(args, path);
        return { content: [{ type: "text", text: stdout }] };
      } catch (e: any) {
        return {
          content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
          isError: true,
        };
      }
    },
  • Zod schema for the 'sbom' tool: path (string), format (optional 'cyclonedx' | 'spdx'), production (optional boolean).
    {
      path: z.string().describe("Absolute path to the package directory"),
      format: z
        .enum(["cyclonedx", "spdx"])
        .optional()
        .describe("SBOM format (default: cyclonedx)"),
      production: z.boolean().optional().describe("Only include production dependencies"),
    },
  • src/index.ts:788-813 (registration)
    Registration of the 'sbom' tool on the main MCP server with name 'sbom' and description 'Generate a Software Bill of Materials (SBOM) for a project'.
    server.tool(
      "sbom",
      "Generate a Software Bill of Materials (SBOM) for a project",
      {
        path: z.string().describe("Absolute path to the package directory"),
        format: z
          .enum(["cyclonedx", "spdx"])
          .optional()
          .describe("SBOM format (default: cyclonedx)"),
        production: z.boolean().optional().describe("Only include production dependencies"),
      },
      async ({ path, format, production }) => {
        const args = ["sbom"];
        if (format) args.push(`--sbom-format=${format}`);
        if (production) args.push("--omit=dev");
        try {
          const { stdout } = await run(args, path);
          return { content: [{ type: "text", text: stdout }] };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
    );
  • Helper function `run` that executes npm commands via execFile with timeout, large buffer, NO_COLOR env, and optional cwd. Used by the sbom handler.
    async function run(
      args: string[],
      cwd?: string,
    ): Promise<{ stdout: string; stderr: string }> {
      const fullArgs = [...args, ...npmrcArgs];
      const opts: { cwd?: string; timeout: number; env: NodeJS.ProcessEnv; maxBuffer: number } = {
        timeout: 120_000,
        maxBuffer: 10 * 1024 * 1024, // 10MB buffer for large outputs
        env: { ...process.env, NO_COLOR: "1" },
      };
      if (cwd) opts.cwd = cwd;
      return exec(NPM, fullArgs, opts);
    }
  • src/index.ts:1366-1370 (registration)
    Registration of the 'sbom' tool in the sandbox server (a read-only simulation server), with a noop handler.
    sandbox.tool("sbom", "Generate a Software Bill of Materials", {
      path: z.string().describe("Absolute path to the package directory"),
      format: z.enum(["cyclonedx", "spdx"]).optional().describe("SBOM format"),
      production: z.boolean().optional().describe("Only include production dependencies"),
    }, noop);
Behavior2/5

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

No annotations are provided, so the description must cover behavioral traits. It only says 'generate' without specifying side effects (e.g., file writes), required permissions, rate limits, or output characteristics. This is insufficient for an AI agent to understand the tool's 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 a single, concise sentence that effectively communicates the purpose without unnecessary words. It is front-loaded and direct.

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?

Despite having 3 parameters and no output schema, the description is too brief. It fails to explain what the tool outputs (e.g., prints to stdout, saves a file), the format of the SBOM, or any behavioral details. For a generation tool, more context is needed.

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%, so all three parameters have individual descriptions. The tool description adds no extra semantics beyond what the schema provides, leading to a baseline score 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 action ('Generate') and the resource ('Software Bill of Materials (SBOM)'), and the tool name matches. It sufficiently distinguishes from sibling tools as no other tool is specifically for SBOM generation.

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, nor any exclusions or prerequisites. Context signals show siblings like 'install' or 'publish', but no hints about when SBOM is appropriate.

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/mikusnuz/npm-mcp'

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