version
Increment package version numbers in npm projects using semantic versioning rules to manage releases and dependencies.
Instructions
Bump the package version
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | Yes | Absolute path to the package directory | |
| bump | Yes | Version bump type | |
| preid | No | Prerelease identifier (e.g. alpha, beta) | |
| noGitTag | No | Skip git tag creation |
Implementation Reference
- src/index.ts:81-106 (handler)The implementation of the 'version' tool, which wraps `npm version` to bump package versions.
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, }; } }, );