Skip to main content
Glama

dist-tag

List, add, or remove distribution tags for npm packages to control release channels and manage version visibility.

Instructions

Manage distribution tags

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
actionYesAction to perform
packageYesPackage name (for add: pkg@version)
tagNoTag name (required for add/rm)

Implementation Reference

  • src/index.ts:233-254 (registration)
    Both the registration (using server.tool) and the handler (the async callback) for the 'dist-tag' tool are defined here. The registration uses server.tool with name 'dist-tag', description 'Manage distribution tags', and a schema with action (ls/add/rm), package, and tag fields. The handler executes 'npm dist-tag <action> <package> [tag]' via the run helper.
    server.tool(
      "dist-tag",
      "Manage distribution tags",
      {
        action: z.enum(["ls", "add", "rm"]).describe("Action to perform"),
        package: z.string().describe("Package name (for add: pkg@version)"),
        tag: z.string().optional().describe("Tag name (required for add/rm)"),
      },
      async ({ action, package: pkg, tag }) => {
        const args = ["dist-tag", action, pkg];
        if (tag && (action === "add" || action === "rm")) args.push(tag);
        try {
          const { stdout } = await run(args);
          return { content: [{ type: "text", text: stdout }] };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
    );
  • Input schema for the dist-tag tool, defining action (enum: ls/add/rm), package (string), and optional tag (string) using Zod validations.
    {
      action: z.enum(["ls", "add", "rm"]).describe("Action to perform"),
      package: z.string().describe("Package name (for add: pkg@version)"),
      tag: z.string().optional().describe("Tag name (required for add/rm)"),
    },
  • The run helper function that executes npm commands (used by the dist-tag handler). It merges npmrcArgs for authentication and calls child_process.execFile with the npm binary.
    async function run(
      args: string[],
      cwd?: string,
    ): Promise<{ stdout: string; stderr: string }> {
      const fullArgs = [...args, ...npmrcArgs];
      const opts: { cwd?: string; timeout: number; env: NodeJS.ProcessEnv; maxBuffer: number } = {
        timeout: 120_000,
        maxBuffer: 10 * 1024 * 1024, // 10MB buffer for large outputs
        env: { ...process.env, NO_COLOR: "1" },
      };
      if (cwd) opts.cwd = cwd;
      return exec(NPM, fullArgs, opts);
    }
    
    const server = new McpServer({
      name: "npm-mcp",
      version: "1.2.0",
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, and the description does not disclose behavioral traits such as what happens when adding a tag that already exists, or the effects of removing a tag.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single sentence with no fluff, but it lacks substance; it is minimally concise but not informative enough.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

With no annotations or output schema, the tool description is too brief. It does not explain how tags relate to distribution or the expected behavior, leaving significant gaps for an AI agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 100%, and the schema descriptions provide adequate meanings for action (enum), package, and tag. The tool description adds no additional parameter context beyond the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Manage distribution tags' gives a general sense but lacks specificity. It doesn't mention the available actions (ls, add, rm) or differentiate from sibling tools like 'version' or 'publish'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance on when to use this tool versus alternatives. Siblings include 'deprecate', 'unpublish', and 'version', which could overlap, but no exclusions or context are provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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