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
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the package directory | |
| package | Yes | Package name to explain |
Implementation Reference
- src/index.ts:766-785 (handler)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, }; } }, );