Skip to main content
Glama
AstroMined
by AstroMined

delete_issue_comment

Remove an issue comment from a GitHub repository by specifying the owner, repo, issue number, and comment ID. Streamlines the process of comment deletion for efficient issue management.

Instructions

Delete an issue comment.

Args: params: Parameters for deleting a comment including: - owner: Repository owner (user or organization) - repo: Repository name - issue_number: Issue number containing the comment - comment_id: Comment ID to delete Returns: Empty response on success

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
paramsYes

Implementation Reference

  • MCP tool handler for 'delete_issue_comment'. Validates input using DeleteIssueCommentParams, delegates to operations.issues.delete_issue_comment, handles errors, and formats MCP response.
    @tool() def delete_issue_comment(params: DeleteIssueCommentParams) -> dict: """Delete an issue comment. Args: params: Parameters for deleting a comment including: - owner: Repository owner (user or organization) - repo: Repository name - issue_number: Issue number containing the comment - comment_id: Comment ID to delete Returns: Empty response on success """ try: logger.debug(f"delete_issue_comment called with params: {params}") # Pass the Pydantic model directly to the operation issues.delete_issue_comment(params) logger.debug("Comment deleted successfully") return {"content": [{"type": "text", "text": "Comment deleted successfully"}]} except GitHubError as e: logger.error(f"GitHub error: {e}") return { "content": [{"type": "error", "text": format_github_error(e)}], "is_error": True } except Exception as e: logger.error(f"Unexpected error: {e}") logger.error(traceback.format_exc()) error_msg = str(e) if str(e) else "An unexpected error occurred" return { "content": [{"type": "error", "text": f"Internal server error: {error_msg}"}], "is_error": True }
  • Pydantic model defining the input schema for the delete_issue_comment tool, inheriting from RepositoryRef (owner/repo).
    class DeleteIssueCommentParams(RepositoryRef): """Parameters for deleting an issue comment.""" model_config = ConfigDict(strict=True) issue_number: int = Field(..., description="Issue number containing the comment") comment_id: int = Field(..., description="Comment ID to delete")
  • Registers the delete_issue_comment tool (line 456) along with other issue tools using register_tools.
    def register(mcp: FastMCP) -> None: """Register all issue tools with the MCP server. Args: mcp: The MCP server instance """ from pygithub_mcp_server.tools import register_tools # List of all issue tools to register issue_tools = [ create_issue, list_issues, get_issue, update_issue, add_issue_comment, list_issue_comments, update_issue_comment, delete_issue_comment, add_issue_labels, remove_issue_label, ] register_tools(mcp, issue_tools) logger.debug(f"Registered {len(issue_tools)} issue tools")
  • Core helper function that executes the GitHub API deletion of the issue comment via PyGithub.
    def delete_issue_comment(params: DeleteIssueCommentParams) -> None: """Delete an issue comment. Args: params: Validated parameters for deleting a comment Raises: GitHubError: If the API request fails """ try: client = GitHubClient.get_instance() repository = client.get_repo(f"{params.owner}/{params.repo}") issue = repository.get_issue(params.issue_number) comment = issue.get_comment(params.comment_id) comment.delete() except GithubException as e: raise GitHubClient.get_instance()._handle_github_exception(e)

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/AstroMined/pygithub-mcp-server'

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