Skip to main content
Glama

deprecate

Mark a specific version of an npm package as deprecated with a custom message, or remove deprecation by providing an empty string.

Instructions

Deprecate a version of a package

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
packageYesPackage@version range (e.g. pkg@<1.0.0)
messageYesDeprecation message (empty string to undeprecate)
otpNoOne-time password for 2FA

Implementation Reference

  • The async handler function for the 'deprecate' tool. It constructs npm deprecate CLI args with package, message, and optional OTP, executes via the run() helper, and returns success or error output.
    async ({ package: pkg, message, otp }) => {
      const args = ["deprecate", pkg, message];
      if (otp) args.push("--otp", otp);
      try {
        const { stdout, stderr } = await run(args);
        return {
          content: [{ type: "text", text: stdout + stderr || (message ? "Deprecated successfully" : "Undeprecated successfully") }],
        };
      } catch (e: any) {
        return {
          content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
          isError: true,
        };
      }
    },
  • Zod schema for the 'deprecate' tool inputs: package (string, @version range), message (string, deprecation message or empty to undeprecate), and optional otp (string, for 2FA).
    {
      package: z.string().describe("Package@version range (e.g. pkg@<1.0.0)"),
      message: z.string().describe("Deprecation message (empty string to undeprecate)"),
      otp: z.string().optional().describe("One-time password for 2FA"),
    },
  • src/index.ts:181-204 (registration)
    Primary registration of the 'deprecate' tool on the MCP server using server.tool() with name 'deprecate', description 'Deprecate a version of a package', the schema, and the handler.
    server.tool(
      "deprecate",
      "Deprecate a version of a package",
      {
        package: z.string().describe("Package@version range (e.g. pkg@<1.0.0)"),
        message: z.string().describe("Deprecation message (empty string to undeprecate)"),
        otp: z.string().optional().describe("One-time password for 2FA"),
      },
      async ({ package: pkg, message, otp }) => {
        const args = ["deprecate", pkg, message];
        if (otp) args.push("--otp", otp);
        try {
          const { stdout, stderr } = await run(args);
          return {
            content: [{ type: "text", text: stdout + stderr || (message ? "Deprecated successfully" : "Undeprecated successfully") }],
          };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
    );
  • src/index.ts:1233-1237 (registration)
    Secondary registration of the 'deprecate' tool in the Smithery sandbox server using a noop handler.
    sandbox.tool("deprecate", "Deprecate a version of a package", {
      package: z.string().describe("Package@version range"),
      message: z.string().describe("Deprecation message"),
      otp: z.string().optional().describe("One-time password for 2FA"),
    }, noop);
  • The run() helper function used by the deprecate handler to execute the npm CLI command with arguments and timeout.
    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);
    }
Behavior2/5

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

With no annotations, the description carries full burden. It does not disclose behavioral traits such as that deprecated versions remain installable with warnings, the need for OTP for 2FA, or that an empty message undeprecates (though the input schema mentions this).

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

Conciseness4/5

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

The description is a single sentence, concise and to the point. No wasted words, but lacks structure like bullet points for important details.

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?

The tool has 3 parameters, no output schema, and no annotations. The description is too minimal; it does not explain return values, error conditions, or provide enough context for an agent to use it correctly.

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% with descriptions for all parameters (package, message, otp). The tool description adds no additional meaning beyond what the schema already provides, so baseline 3 applies.

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

Purpose4/5

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

The description clearly states the action (deprecate) and the resource (version of a package), distinguishing it from sibling tools like 'publish' or 'unpublish'. However, it could be more specific by mentioning version ranges.

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 usage guidelines are provided. The description does not specify when to use deprecate versus alternatives like 'unpublish' or other package management commands.

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