Skip to main content
Glama

explain

Show why a package is installed by displaying its dependency chain for npm projects.

Instructions

Explain why a package is installed (show dependency chain)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the package directory
packageYesPackage name to explain

Implementation Reference

  • Implementation of the "explain" tool for the npm-mcp server.
    server.tool(
      "explain",
      "Explain why a package is installed (show dependency chain)",
      {
        path: z.string().describe("Absolute path to the package directory"),
        package: z.string().describe("Package name to explain"),
      },
      async ({ path, package: pkg }) => {
        const args = ["explain", pkg, "--json"];
        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,
          };
        }
      },
    );

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