Skip to main content
Glama

update_pr_description

Modify pull request titles and descriptions on GitHub to reflect changes in scope, requirements, or context during development.

Instructions

Updates the title and description (body) of a specific pull request on GitHub. Args: repo_owner (str): The owner of the repository. repo_name (str): The name of the repository. pr_number (int): The pull request number to update. new_title (str): The new title for the pull request. new_description (str): The new description (body) for the pull request. Returns: Dict[str, Any]: The updated pull request data as returned by the GitHub API if the update is successful. None: If an error occurs during the update process. Error Handling: Logs an error message and prints the traceback if the update fails due to an exception (e.g., network issues, invalid credentials, or API errors).

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_ownerYes
repo_nameYes
pr_numberYes
new_titleYes
new_descriptionYes

Implementation Reference

  • The handler function that executes the 'update_pr_description' tool logic. It constructs the GitHub API URL for the specified PR and sends a PATCH request to update the PR's title and body (description). Handles errors by logging and returning an error dict.
    def update_pr_description(self, repo_owner: str, repo_name: str, pr_number: int, new_title: str, new_description: str) -> Dict[str, Any]: """ Updates the title and description (body) of a specific pull request on GitHub. Args: repo_owner (str): The owner of the repository. repo_name (str): The name of the repository. pr_number (int): The pull request number to update. new_title (str): The new title for the pull request. new_description (str): The new description (body) for the pull request. Returns: Dict[str, Any]: The updated pull request data as returned by the GitHub API if the update is successful. None: If an error occurs during the update process. Error Handling: Logs an error message and prints the traceback if the update fails due to an exception (e.g., network issues, invalid credentials, or API errors). """ logging.info(f"Updating PR description for {repo_owner}/{repo_name}#{pr_number}") # Construct the PR URL pr_url = self._get_pr_url(repo_owner, repo_name, pr_number) try: # Update the PR description response = requests.patch(pr_url, headers=self._get_headers(), json={ 'title': new_title, 'body': new_description }, timeout=TIMEOUT) response.raise_for_status() pr_data = response.json() logging.info("PR description updated successfully") return pr_data except Exception as e: logging.error(f"Error updating PR description: {str(e)}") traceback.print_exc() return {"status": "error", "message": str(e)}
  • The registration code that dynamically discovers and registers all public methods (including 'update_pr_description') from the GitHubIntegration instance as MCP tools using FastMCP's add_tool method. Called via _register_tools(self.gi).
    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)
  • The entry point for tool registration, which invokes register_tools on the GitHubIntegration instance (self.gi), thereby registering the 'update_pr_description' handler.
    def _register_tools(self): self.register_tools(self.gi) self.register_tools(self.ip)

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