Skip to main content
Glama

tag_create

Create and manage Git tags with a specified name, message, and options like force creation, annotation, or signing. Supports repository path input for precise tag management.

Instructions

Create a tag

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
annotatedNoCreate an annotated tag
forceNoForce create tag even if it exists
messageNoTag message
nameYesTag name
pathNoPath to repository. MUST be an absolute path (e.g., /Users/username/projects/my-repo)
signNoCreate a signed tag

Implementation Reference

  • The core handler function for the 'tag_create' tool. Validates the repository and tag name, constructs the appropriate 'git tag' or 'git tag -a -m' command, executes it using CommandExecutor, formats the output, manages caching, and returns the GitToolResult.
    static async tagCreate({ path, name, message }: TagOptions, context: GitToolContext): Promise<GitToolResult> { const resolvedPath = this.getPath({ path }); return await this.executeOperation( context.operation, resolvedPath, async () => { const { path: repoPath } = PathValidator.validateGitRepo(resolvedPath); PathValidator.validateTagName(name); let command = `tag ${name}`; if (typeof message === 'string' && message.length > 0) { command = `tag -a ${name} -m "${message}"`; } const result = await CommandExecutor.executeGitCommand( command, context.operation, repoPath ); return { content: [{ type: 'text', text: `Tag '${name}' created successfully\n${CommandExecutor.formatOutput(result)}` }] }; }, { command: 'tag_create', invalidateCache: true, // Invalidate tag cache stateType: RepoStateType.TAG } ); }
  • Registers the 'tag_create' tool with the MCP server in the ListTools response, providing the tool name, description, and detailed input JSON schema.
    { name: 'tag_create', description: 'Create a tag', inputSchema: { type: 'object', properties: { path: { type: 'string', description: `Path to repository. ${PATH_DESCRIPTION}`, }, name: { type: 'string', description: 'Tag name', }, message: { type: 'string', description: 'Tag message', }, force: { type: 'boolean', description: 'Force create tag even if it exists', default: false }, annotated: { type: 'boolean', description: 'Create an annotated tag', default: true }, sign: { type: 'boolean', description: 'Create a signed tag', default: false } }, required: ['name'], }, },
  • TypeScript interface defining the TagOptions type used for input validation in the tag_create handler.
    export interface TagOptions extends GitOptions, BasePathOptions { name: string; message?: string; force?: boolean; // Allow force operations annotated?: boolean; // Create an annotated tag sign?: boolean; // Create a signed tag }
  • Runtime type guard function isTagOptions used to validate arguments before calling the tag_create handler.
    export function isTagOptions(obj: any): obj is TagOptions { return obj && validatePath(obj.path) && typeof obj.name === 'string'; }
  • Dispatches calls to the 'tag_create' tool by validating arguments with isTagOptions and invoking GitOperations.tagCreate.
    case 'tag_create': { const validArgs = this.validateArguments(operation, args, isTagOptions); return await GitOperations.tagCreate(validArgs, context); }

Other Tools

Related 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/Sheshiyer/git-mcp-v2'

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