Skip to main content
Glama

pack

Create a tarball from an npm package directory to preview what would be published. Use the dry-run option to list files without generating the archive.

Instructions

Create a tarball from a package (preview what would be published)

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the package directory
dryRunNoList files without creating tarball

Implementation Reference

  • The registration and handler implementation for the "pack" tool, which creates a tarball of an npm package.
    server.tool(
      "pack",
      "Create a tarball from a package (preview what would be published)",
      {
        path: z.string().describe("Absolute path to the package directory"),
        dryRun: z.boolean().optional().describe("List files without creating tarball"),
      },
      async ({ path, dryRun }) => {
        const args = ["pack"];
        if (dryRun) args.push("--dry-run");
        args.push("--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