git_create_tag
Create annotated or lightweight tags in Git repositories to mark specific commits for versioning, releases, or reference points.
Instructions
Create a tag.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| repo_path | Yes | The path to the local Git repository | |
| tag_name | Yes | Name of the tag | |
| message | No | Tag message (for annotated tags) | |
| annotated | No | Whether to create an annotated tag |
Implementation Reference
- src/handlers/tag-operations.js:11-59 (handler)The core implementation of the git_create_tag tool handler. It uses simpleGit to create either a lightweight or annotated tag in the specified repository, returning success/error JSON responses.export async function handleGitCreateTag({ repo_path, tag_name, message = "", annotated = true, }) { try { const git = simpleGit(repo_path); if (annotated) { await git.addAnnotatedTag(tag_name, message); } else { await git.addTag(tag_name); } return { content: [ { type: "text", text: JSON.stringify( { success: true, message: `Created ${ annotated ? "annotated " : "" }tag: ${tag_name}`, tag: tag_name, }, null, 2 ), }, ], }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify( { error: `Failed to create tag: ${error.message}` }, null, 2 ), }, ], isError: true, }; } }
- src/server.js:509-536 (schema)Defines the input schema, description, and parameters for the git_create_tag tool in the MCP tools list.{ name: "git_create_tag", description: "Create a tag.", inputSchema: { type: "object", properties: { repo_path: { type: "string", description: "The path to the local Git repository", }, tag_name: { type: "string", description: "Name of the tag", }, message: { type: "string", description: "Tag message (for annotated tags)", default: "", }, annotated: { type: "boolean", description: "Whether to create an annotated tag", default: true, }, }, required: ["repo_path", "tag_name"], }, },
- src/server.js:915-915 (registration)Registers the 'git_create_tag' tool name to its handler function in the server's handlersMap for request dispatching.git_create_tag: handleGitCreateTag,
- src/handlers/index.js:26-26 (registration)Imports the handleGitCreateTag function from its implementation file.import { handleGitCreateTag } from "./tag-operations.js";
- src/handlers/index.js:69-69 (registration)Re-exports the handleGitCreateTag function for use in server.js.handleGitCreateTag,