Skip to main content
Glama

version

Bump the package version by specifying the bump type (patch, minor, major, etc.), optional prerelease identifier, and whether to skip git tag creation. Requires the absolute path to the package directory.

Instructions

Bump the package version

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pathYesAbsolute path to the package directory
bumpYesVersion bump type
preidNoPrerelease identifier (e.g. alpha, beta)
noGitTagNoSkip git tag creation

Implementation Reference

  • src/index.ts:81-105 (registration)
    Registration of the 'version' tool on the MCP server with name 'version' and description 'Bump the package version'. Defines schema inputs (path, bump, preid, noGitTag) and the handler callback.
    server.tool(
      "version",
      "Bump the package version",
      {
        path: z.string().describe("Absolute path to the package directory"),
        bump: z
          .enum(["patch", "minor", "major", "prepatch", "preminor", "premajor", "prerelease"])
          .describe("Version bump type"),
        preid: z.string().optional().describe("Prerelease identifier (e.g. alpha, beta)"),
        noGitTag: z.boolean().optional().describe("Skip git tag creation"),
      },
      async ({ path, bump, preid, noGitTag }) => {
        const args = ["version", bump];
        if (preid) args.push("--preid", preid);
        if (noGitTag) args.push("--no-git-tag-version");
        try {
          const { stdout } = await run(args, path);
          return { content: [{ type: "text", text: stdout.trim() }] };
        } catch (e: any) {
          return {
            content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
            isError: true,
          };
        }
      },
  • Handler function that executes the 'version' tool logic: constructs 'npm version <bump>' CLI args, calls the run() helper, and returns the stdout output or an error message.
    async ({ path, bump, preid, noGitTag }) => {
      const args = ["version", bump];
      if (preid) args.push("--preid", preid);
      if (noGitTag) args.push("--no-git-tag-version");
      try {
        const { stdout } = await run(args, path);
        return { content: [{ type: "text", text: stdout.trim() }] };
      } catch (e: any) {
        return {
          content: [{ type: "text", text: `Error: ${e.stderr || e.message}` }],
          isError: true,
        };
      }
    },
  • Input schema for the 'version' tool: path (string), bump (enum of patch/minor/major/prepatch/preminor/premajor/prerelease), preid (optional string), noGitTag (optional boolean).
    {
      path: z.string().describe("Absolute path to the package directory"),
      bump: z
        .enum(["patch", "minor", "major", "prepatch", "preminor", "premajor", "prerelease"])
        .describe("Version bump type"),
      preid: z.string().optional().describe("Prerelease identifier (e.g. alpha, beta)"),
      noGitTag: z.boolean().optional().describe("Skip git tag creation"),
    },
  • The run() helper function that wraps execFile to execute npm commands. Used by the version tool handler to run 'npm version <bump>'.
    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?

Without annotations, the description carries the burden of disclosing side effects. It only states 'Bump the package version' but does not explain that it modifies package.json, creates a git tag by default (as implied by the noGitTag parameter), or other effects. This is insufficient for a mutation tool.

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. It could include a bit more context but it is not verbose. Front-loads the action well.

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?

Given the tool has 4 parameters and no output schema, the description is too brief. It does not explain the overall workflow, return values (like the new version or success status), or any prerequisites. This leaves gaps for the 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 description coverage is 100%, so the schema already documents all parameters adequately. The description adds no additional parameter context, but the baseline of 3 is appropriate since the schema itself is complete.

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

Purpose5/5

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

The description 'Bump the package version' is a clear verb+resource statement. It specifically indicates the tool's purpose and differentiates it from sibling tools which cover other npm commands like install, publish, etc.

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 is provided on when to use this tool versus alternatives or prerequisites. The description does not mention any context for invoking the tool, such as requiring an existing package with a version field.

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