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

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

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';
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries full burden for behavioral disclosure. 'Delete a tag' implies a destructive mutation, but it doesn't specify whether deletion is permanent, requires specific permissions, has side effects, or provides confirmation. For a destructive tool with zero annotation coverage, this leaves critical behavioral traits undisclosed.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise—three words—with zero wasted language. It's front-loaded with the core action and resource. Every word earns its place, making it efficient for quick comprehension.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given this is a destructive tool with no annotations and no output schema, the description is incomplete. It doesn't address safety considerations, error conditions, or what happens post-deletion. For a tool that permanently removes data, more context is needed to guide safe usage.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, with both parameters ('name' and 'path') well-documented in the schema. The description adds no parameter semantics beyond what the schema provides—it doesn't explain format constraints, examples, or relationships between parameters. Baseline 3 is appropriate when the schema does the heavy lifting.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Delete a tag' clearly states the verb (delete) and resource (tag), making the purpose immediately understandable. It distinguishes from sibling tools like 'tag_create' and 'tag_list' by specifying the destructive action. However, it doesn't specify what kind of tag (e.g., Git tag) or provide additional context about the resource being deleted.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., tag must exist), when not to use it (e.g., if tag is referenced elsewhere), or direct alternatives among siblings. The agent must infer usage from the tool name alone.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

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