Skip to main content
Glama

push_git_tag

Push a specified Git tag to the default remote repository. Requires the repository name and tag name to execute the operation, returning status and details about the action.

Instructions

Push a git tag to the default remote

Args:
    repo_name: Name of the git repository
    tag_name: Name of the tag to push

Returns:
    Dictionary containing status and information about the operation

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_nameYes
tag_nameYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The handler function decorated with @mcp.tool(), which registers and implements the push_git_tag tool. It validates the repo and tag, finds the default remote, pushes the tag, and returns status info.
    @mcp.tool()
    def push_git_tag(ctx: Context, repo_name: str, tag_name: str) -> Dict[str, str]:
        """Push a git tag to the default remote
    
        Args:
            repo_name: Name of the git repository
            tag_name: Name of the tag to push
    
        Returns:
            Dictionary containing status and information about the operation
        """
        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}")
    
        # Validate tag exists
        try:
            _run_git_command(repo_path, ["tag", "-l", tag_name])
        except ValueError:
            return {
                "status": "error",
                "error": f"Tag {tag_name} not found in repository {repo_name}",
            }
    
        # Get the default remote (usually 'origin')
        try:
            remote = _run_git_command(repo_path, ["remote"])
            if not remote:
                return {
                    "status": "error",
                    "error": f"No remote configured for repository {repo_name}",
                }
            # Use the first remote if multiple are available
            default_remote = remote.split("\n")[0].strip()
    
            # Push the tag to the remote
            push_result = _run_git_command(repo_path, ["push", default_remote, tag_name])
    
            return {
                "status": "success",
                "remote": default_remote,
                "tag": tag_name,
                "message": f"Successfully pushed tag {tag_name} to remote {default_remote}",
            }
        except ValueError as e:
            return {"status": "error", "error": str(e)}
  • Helper utility function used by the push_git_tag handler (and others) to safely execute git commands in a repository context, capturing output and raising errors appropriately.
    def _run_git_command(repo_path: str, command: List[str]) -> str:
        """Run a git command in the specified repository path"""
        if not os.path.exists(repo_path):
            raise ValueError(f"Repository path does not exist: {repo_path}")
    
        full_command = ["git"] + command
        try:
            result = subprocess.run(
                full_command, cwd=repo_path, check=True, capture_output=True, text=True
            )
            return result.stdout.strip()
        except subprocess.CalledProcessError as e:
            error_message = e.stderr.strip() if e.stderr else str(e)
            raise ValueError(f"Git command failed: {error_message}")
Behavior2/5

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

No annotations are provided, so the description carries the full burden. It mentions the operation pushes to the 'default remote', which adds some context, but fails to disclose critical behavioral traits such as required permissions, whether it overwrites existing tags, error handling, or rate limits. For a mutation tool with zero annotation coverage, this is a significant gap.

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 front-loaded with the core purpose, followed by structured sections for Args and Returns. Every sentence earns its place with no redundancy, making it efficiently sized and well-organized for quick comprehension.

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 2 parameters with 0% schema coverage and no annotations, the description partially compensates by listing parameters and mentioning a return dictionary. However, as a mutation tool, it lacks details on permissions, side effects, or error cases. The output schema exists, so return values needn't be explained, but overall completeness is adequate with clear gaps.

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?

Schema description coverage is 0%, so the description must compensate. It explicitly lists both parameters ('repo_name' and 'tag_name') with brief explanations, adding meaning beyond the bare schema. However, it doesn't detail format constraints (e.g., valid tag names) or examples, preventing a score of 5.

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 ('push') and resource ('git tag'), specifying it pushes to the 'default remote'. It distinguishes from siblings like 'create_git_tag' (creation vs. pushing) and 'list_repositories' (listing vs. pushing). However, it doesn't explicitly differentiate from all siblings (e.g., 'refresh_repository' might involve pushing), keeping it at 4 rather than 5.

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

Usage Guidelines3/5

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

The description implies usage when a tag needs to be pushed to a remote, but lacks explicit guidance on when to use this vs. alternatives. For example, it doesn't clarify if this should follow 'create_git_tag' or when to use 'refresh_repository' instead. The context is clear but no exclusions or named alternatives are provided.

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