Skip to main content
Glama

dedupe

Remove duplicate dependencies from npm packages to optimize project size and resolve version conflicts. Specify a package directory path to clean up redundant modules.

Instructions

Reduce duplication in the dependency tree

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the package directory
dryRunNoPreview changes without making them

Implementation Reference

  • The 'dedupe' tool is registered and implemented in src/index.ts. It calls the 'run' helper function with the 'dedupe' npm command and provided arguments.
    server.tool(
      "dedupe",
      "Reduce duplication in the dependency tree",
      {
        path: z.string().describe("Absolute path to the package directory"),
        dryRun: z.boolean().optional().describe("Preview changes without making them"),
      },
      async ({ path, dryRun }) => {
        const args = ["dedupe"];
        if (dryRun) args.push("--dry-run");
        try {
          const { stdout, stderr } = await run(args, path);
          return { content: [{ type: "text", text: stdout + stderr || "Deduplication complete" }] };
        } 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