Skip to main content
Glama

create_git_tag

Create and manage Git tags in a repository, specifying a tag name and optional message, to track specific points in history using the Git MCP server.

Instructions

Create a new git tag in the repository

Args:
    repo_name: Name of the git repository
    tag_name: Name of the tag to create
    message: Optional message for annotated tag

Returns:
    Dictionary containing status and tag information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
messageNo
repo_nameYes
tag_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The main handler function for the 'create_git_tag' tool. It creates a git tag (annotated or lightweight) in the specified repository using subprocess to run git commands. Includes validation, execution, and returns status with tag info.
    @mcp.tool()
    def create_git_tag(
        ctx: Context, repo_name: str, tag_name: str, message: Optional[str] = None
    ) -> Dict[str, str]:
        """Create a new git tag in the repository
    
        Args:
            repo_name: Name of the git repository
            tag_name: Name of the tag to create
            message: Optional message for annotated tag
    
        Returns:
            Dictionary containing status and tag information
        """
        git_repos_path = ctx.request_context.lifespan_context.git_repos_path
        repo_path = os.path.join(git_repos_path, repo_name)
    
        # Validate repository exists
        if not os.path.exists(repo_path) or not os.path.exists(
            os.path.join(repo_path, ".git")
        ):
            raise ValueError(f"Repository not found: {repo_name}")
    
        # Create the tag command
        if message:
            # Create annotated tag with message
            tag_command = ["tag", "-a", tag_name, "-m", message]
        else:
            # Create lightweight tag
            tag_command = ["tag", tag_name]
    
        # Execute the tag command
        try:
            _run_git_command(repo_path, tag_command)
    
            # Get tag date
            tag_date_str = _run_git_command(
                repo_path, ["log", "-1", "--format=%ai", tag_name]
            )
    
            # Parse the date string into a datetime object
            tag_date = datetime.strptime(tag_date_str, "%Y-%m-%d %H:%M:%S %z")
            formatted_date = tag_date.strftime("%Y-%m-%d %H:%M:%S")
    
            return {
                "status": "success",
                "version": tag_name,
                "date": formatted_date,
                "type": "annotated" if message else "lightweight",
            }
        except ValueError as e:
            return {"status": "error", "error": str(e)}
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions creating a tag and that the message is optional for annotated tags, but fails to cover critical aspects like whether this requires write permissions, if it's a local or remote operation, error conditions (e.g., duplicate tags), or side effects. This leaves significant gaps for safe and effective tool invocation.

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

Conciseness4/5

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

The description is well-structured with clear sections for Args and Returns, and each sentence adds value without redundancy. It could be slightly more front-loaded by moving the return statement earlier, but overall it's efficient and easy to parse.

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

Completeness3/5

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

Given the tool's moderate complexity (3 parameters, no annotations, but with an output schema), the description is minimally adequate. The output schema likely covers return values, reducing the need for detailed return explanations. However, it lacks sufficient behavioral and usage context, making it incomplete for safe operation without additional inference.

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

Parameters4/5

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

The description adds meaningful context beyond the input schema, which has 0% description coverage. It clarifies that 'message' is optional and for annotated tags, and implies 'repo_name' and 'tag_name' are required. However, it doesn't detail constraints (e.g., tag naming rules) or provide examples, leaving some ambiguity for the agent.

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 clearly states the action ('Create a new git tag') and resource ('in the repository'), making the purpose immediately understandable. However, it doesn't explicitly differentiate from sibling tools like 'push_git_tag' or 'get_last_git_tag', which would require more specific context about when each is appropriate.

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 like 'push_git_tag' or 'get_last_git_tag'. It lacks context about prerequisites (e.g., whether the repository must exist locally) or typical use cases (e.g., tagging releases vs. lightweight tags), leaving the agent to 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/kjozsa/git-mcp'

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