Skip to main content
Glama

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
NameRequiredDescriptionDefault
repo_pathYesThe path to the local Git repository
tag_nameYesName of the tag
messageNoTag message (for annotated tags)
annotatedNoWhether to create an annotated tag

Implementation Reference

  • 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, }; } }
  • 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,
  • Imports the handleGitCreateTag function from its implementation file.
    import { handleGitCreateTag } from "./tag-operations.js";
  • Re-exports the handleGitCreateTag function for use in server.js.
    handleGitCreateTag,

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/bsreeram08/git-commands-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server