Skip to main content
Glama

cache

Manage npm package cache by cleaning outdated files, verifying integrity, or listing contents to optimize storage and ensure reliable package installations.

Instructions

Manage the npm cache

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction: clean (clear cache), verify (check integrity), ls (list contents)
forceNoForce clean (required for clean action)

Implementation Reference

  • The "cache" tool implementation, which executes npm cache commands using the `run` helper function.
    server.tool(
      "cache",
      "Manage the npm cache",
      {
        action: z.enum(["clean", "verify", "ls"]).describe("Action: clean (clear cache), verify (check integrity), ls (list contents)"),
        force: z.boolean().optional().describe("Force clean (required for clean action)"),
      },
      async ({ action, force }) => {
        const args = ["cache", action];
        if (action === "clean" && force) args.push("--force");
        try {
          const { stdout, stderr } = await run(args);
          return { content: [{ type: "text", text: stdout + stderr || "Done" }] };
        } 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