Skip to main content
Glama
saidsef

GitHub PR Issue Analyser

by saidsef

create_release

Create a new release in a GitHub repository by specifying tag name, release name, and description to organize and distribute software versions.

Instructions

Creates a new release 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 tag name for the release. release_name (str): The name of the release. body (str): The description or body content of the release. Returns: Dict[str, Any]: The JSON response from the GitHub API containing release information if successful. None: If an error occurs during the release creation process. Error Handling: Logs errors and prints the traceback if the release creation fails, returning None.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_ownerYes
repo_nameYes
tag_nameYes
release_nameYes
bodyYes

Implementation Reference

  • The handler function implementing the 'create_release' tool. It creates a new GitHub release by posting to the GitHub API with the provided repository details, tag, name, and body.
    def create_release(self, repo_owner: str, repo_name: str, tag_name: str, release_name: str, body: str) -> Dict[str, Any]:
        """
        Creates a new release 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 tag name for the release.
            release_name (str): The name of the release.
            body (str): The description or body content of the release.
        Returns:
            Dict[str, Any]: The JSON response from the GitHub API containing release information if successful.
            None: If an error occurs during the release creation process.
        Error Handling:
            Logs errors and prints the traceback if the release creation fails, returning None.
        """
        logging.info(f"Creating release {release_name} in {repo_owner}/{repo_name}")
    
        # Construct the releases URL
        releases_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/releases"
    
        try:
            # Create the release
            response = requests.post(releases_url, headers=self._get_headers(), json={
                'tag_name': tag_name,
                'name': release_name,
                'body': body,
                'draft': False,
                'prerelease': False,
                'generate_release_notes': True
            }, timeout=TIMEOUT)
            response.raise_for_status()
            release_data = response.json()
    
            logging.info("Release created successfully")
            return release_data
    
        except Exception as e:
            logging.error(f"Error creating release: {str(e)}")
            traceback.print_exc()
            return {"status": "error", "message": str(e)}
  • The registration code that dynamically registers all public methods of the GitHubIntegration instance (including create_release) as MCP tools via FastMCP.add_tool.
        self.register_tools(self.gi)
        self.register_tools(self.ip)
    
    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)
  • Documentation in the MCP server instructions mentioning the create_release tool.
    - Use create_tag and create_release for release management
  • Instantiation of the GitHubIntegration class whose methods are registered as tools.
    self.gi = GI()
  • Import of the GitHubIntegration class containing the create_release handler.
    from .github_integration import GitHubIntegration as GI

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