Skip to main content
Glama

tag_delete

Remove a specific Git tag by specifying the repository path and tag name. Streamline tag management for repositories with this Git MCP Server tool.

Instructions

Delete a tag

Input Schema

NameRequiredDescriptionDefault
nameYesTag name
pathNoPath to repository. MUST be an absolute path (e.g., /Users/username/projects/my-repo)

Input Schema (JSON Schema)

{ "properties": { "name": { "description": "Tag name", "type": "string" }, "path": { "description": "Path to repository. MUST be an absolute path (e.g., /Users/username/projects/my-repo)", "type": "string" } }, "required": [ "name" ], "type": "object" }

Implementation Reference

  • The primary handler function implementing the tag_delete tool. It resolves the repository path, validates the tag name and existence, executes the 'git tag -d {name}' command, formats the output, invalidates the tag cache, and returns a success result.
    static async tagDelete({ path, name }: 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); await RepositoryValidator.validateTagExists(repoPath, name, context.operation); const result = await CommandExecutor.executeGitCommand( `tag -d ${name}`, context.operation, repoPath ); return { content: [{ type: 'text', text: `Tag '${name}' deleted successfully\n${CommandExecutor.formatOutput(result)}` }] }; }, { command: 'tag_delete', invalidateCache: true, // Invalidate tag cache stateType: RepoStateType.TAG } ); }
  • Registers the 'tag_delete' tool with the MCP server, providing the tool name, description, and JSON input schema specifying required 'name' parameter and optional 'path'.
    { name: 'tag_delete', description: 'Delete a tag', inputSchema: { type: 'object', properties: { path: { type: 'string', description: `Path to repository. ${PATH_DESCRIPTION}`, }, name: { type: 'string', description: 'Tag name', }, }, required: ['name'], }, },
  • Tool executor switch case that validates input arguments using isTagOptions type guard and delegates to GitOperations.tagDelete.
    case 'tag_delete': { const validArgs = this.validateArguments(operation, args, isTagOptions); return await GitOperations.tagDelete(validArgs, context); }
  • TypeScript interface TagOptions defining input shape (path?: string, name: string, and extras) and runtime type guard isTagOptions used for validation.
    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 } export interface RemoteOptions extends GitOptions, BasePathOptions { name: string; url?: string; force?: boolean; // Allow force operations mirror?: boolean; // Mirror all refs tags?: boolean; // Include tags } export interface StashOptions extends GitOptions, BasePathOptions { message?: string; index?: number; includeUntracked?: boolean; // Include untracked files keepIndex?: boolean; // Keep staged changes all?: boolean; // Include ignored files } // New bulk action interfaces export interface BulkActionStage { type: 'stage'; files?: string[]; // If not provided, stages all files } export interface BulkActionCommit { type: 'commit'; message: string; } export interface BulkActionPush { type: 'push'; remote?: string; branch: string; } export type BulkAction = BulkActionStage | BulkActionCommit | BulkActionPush; export interface BulkActionOptions extends GitOptions, BasePathOptions { actions: BulkAction[]; } // Type guard functions export function isAbsolutePath(path: string): boolean { return path.startsWith('/'); } export function validatePath(path?: string): boolean { return !path || isAbsolutePath(path); } export function isInitOptions(obj: any): obj is InitOptions { return obj && validatePath(obj.path); } export function isCloneOptions(obj: any): obj is CloneOptions { return obj && typeof obj.url === 'string' && validatePath(obj.path); } export function isAddOptions(obj: any): obj is AddOptions { return obj && validatePath(obj.path) && Array.isArray(obj.files) && obj.files.every((f: any) => typeof f === 'string' && isAbsolutePath(f)); } export function isCommitOptions(obj: any): obj is CommitOptions { return obj && validatePath(obj.path) && typeof obj.message === 'string'; } export function isPushPullOptions(obj: any): obj is PushPullOptions { return obj && validatePath(obj.path) && typeof obj.branch === 'string'; } export function isBranchOptions(obj: any): obj is BranchOptions { return obj && validatePath(obj.path) && typeof obj.name === 'string'; } export function isCheckoutOptions(obj: any): obj is CheckoutOptions { return obj && validatePath(obj.path) && typeof obj.target === 'string'; } export function isTagOptions(obj: any): obj is TagOptions { return obj && validatePath(obj.path) && typeof obj.name === 'string'; }

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