Skip to main content
Glama
saidsef

GitHub PR Issue Analyser

by saidsef

create_tag

Create version tags in GitHub repositories to mark releases, milestones, or specific commits with descriptive messages.

Instructions

Creates a new tag in the specified GitHub repository. Args: repo_owner (str): The owner of the repository. repo_name (str): The name of the repository. tag_name (str): The name of the tag to create. message (str): The message associated with the tag. Returns: Dict[str, Any]: The response data from the GitHub API if the tag is created successfully. None: If an error occurs during the tag creation process. Error Handling: Logs errors and prints the traceback if fetching the latest commit SHA fails or if the GitHub API request fails.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_ownerYes
repo_nameYes
tag_nameYes
messageYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes

Implementation Reference

  • The core handler function implementing the 'create_tag' tool logic. It fetches the latest commit SHA and creates a lightweight GitHub tag using the GitHub Refs API.
    def create_tag(self, repo_owner: str, repo_name: str, tag_name: str, message: str) -> Dict[str, Any]:
        """
        Creates a new tag in the specified GitHub repository.
        Args:
            repo_owner (str): The owner of the repository.
            repo_name (str): The name of the repository.
            tag_name (str): The name of the tag to create.
            message (str): The message associated with the tag.
        Returns:
            Dict[str, Any]: The response data from the GitHub API if the tag is created successfully.
            None: If an error occurs during the tag creation process.
        Error Handling:
            Logs errors and prints the traceback if fetching the latest commit SHA fails or if the GitHub API request fails.
        """
        logging.info(f"Creating tag {tag_name} in {repo_owner}/{repo_name}")
        # Construct the tags URL
        tags_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/git/refs"
        try:
            # Fetch the latest commit SHA
            latest_sha = self.get_latest_sha(repo_owner, repo_name)
            if not latest_sha:
                raise ValueError("Failed to fetch the latest commit SHA")
    
            # Create the tag
            response = requests.post(tags_url, headers=self._get_headers(), json={
                'ref': f'refs/tags/{tag_name}',
                'sha': latest_sha,
                'message': message
            }, timeout=TIMEOUT)
            response.raise_for_status()
            tag_data = response.json()
    
            logging.info("Tag created successfully")
            return tag_data
    
        except Exception as e:
            logging.error(f"Error creating tag: {str(e)}")
            traceback.print_exc()
            return {"status": "error", "message": str(e)}
  • The registration logic that dynamically adds all public methods from the GitHubIntegration instance (including 'create_tag') to the MCP server as tools.
    def register_tools(self, methods: Any = None) -> None:
        for name, method in inspect.getmembers(methods):
            if (inspect.isfunction(method) or inspect.ismethod(method)) and not name.startswith("_"):
                self.mcp.add_tool(method)
  • Calls the register_tools method on the GitHubIntegration instance to register 'create_tag' and other tools.
    self.register_tools(self.gi)
    self.register_tools(self.ip)
  • Helper method called by create_tag to retrieve the SHA of the latest commit for tagging.
    def get_latest_sha(self, repo_owner: str, repo_name: str) -> Optional[str]:
        """
        Fetches the SHA of the latest commit in the specified GitHub repository.
        Args:
            repo_owner (str): The owner of the GitHub repository.
            repo_name (str): The name of the GitHub repository.
        Returns:
            Optional[str]: The SHA string of the latest commit if found, otherwise None.
        Error Handling:
            Logs errors and warnings if the request fails, the response is invalid, or no commits are found.
            Returns None in case of exceptions or if the repository has no commits.
        """
        logging.info({"status": "info", "message": f"Fetching latest commit SHA for {repo_owner}/{repo_name}"})
    
        # Construct the commits URL
        commits_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/commits"
    
        try:
            # Fetch the latest commit
            response = requests.get(commits_url, headers=self._get_headers(), timeout=TIMEOUT)
            response.raise_for_status()
            commits_data = response.json()
    
            if commits_data:
                latest_sha = commits_data[0]['sha']
                logging.info({"status": "info", "message": f"Latest commit SHA: {latest_sha}"})
                return latest_sha
            else:
                logging.warning({"status": "warning", "message": "No commits found in the repository"})
                return "No commits found in the repository"
    
        except Exception as e:
            logging.error(f"Error fetching latest commit SHA: {str(e)}")
            traceback.print_exc()
            return str(e)
Behavior3/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 error handling ('Logs errors and prints the traceback') and return types (Dict[str, Any] for success, None for errors), which adds useful context beyond just the creation action. However, it doesn't specify authentication requirements, rate limits, or whether this operation is idempotent.

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 (Args, Returns, Error Handling) and front-loaded with the core purpose. While slightly longer than minimal, every section adds value given the lack of annotations and schema descriptions. The structure helps the agent parse information efficiently.

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

Completeness4/5

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

For a 4-parameter mutation tool with no annotations and 0% schema coverage, the description provides good coverage: purpose, all parameters, return values, and error handling. The presence of an output schema reduces the need to fully document return formats. The main gap is lack of usage context versus sibling tools.

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?

With 0% schema description coverage, the description compensates well by documenting all 4 parameters in the Args section with their types and meanings. Each parameter (repo_owner, repo_name, tag_name, message) is clearly explained, providing essential semantic context that the schema alone lacks.

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

Purpose5/5

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

The description clearly states the specific action ('Creates a new tag') and resource ('in the specified GitHub repository'), distinguishing it from sibling tools like create_issue or create_pr. It provides a precise verb+resource combination that leaves no ambiguity about its function.

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 create_release or other GitHub operations. While it's clear this creates tags specifically, there's no context about when tagging is appropriate versus other versioning mechanisms, nor any prerequisites or exclusions mentioned.

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

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/saidsef/mcp-github-pr-issue-analyser'

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