Skip to content

Conversation

PreistlyPython
Copy link

Summary

Implements issue #1083 by adding a new update_issue_comment tool to the GitHub MCP server, enabling users to modify existing issue comments programmatically.

Changes Made

  • New Tool: update_issue_comment with full parameter validation
  • API Integration: Uses GitHub's EditComment API endpoint
  • Error Handling: Comprehensive validation and error responses
  • Testing: 5 test cases covering success, errors, and edge cases
  • Documentation: Auto-generated tool schema snapshots

Implementation Details

Tool Parameters

  • comment_id (string, required): Comment's unique identifier
  • issue_number (number, required): Target issue number
  • owner (string, required): Repository owner
  • repo (string, required): Repository name
  • body (string, required): New comment content

Features

Parameter Validation: Validates all required parameters with meaningful error messages
ID Parsing: Proper comment ID validation (must be positive integer)
Content Validation: Prevents empty or whitespace-only comments
Error Handling: Handles GitHub API errors (404, permissions, etc.)
Existing Patterns: Follows codebase conventions and patterns

Files Modified

  • pkg/github/issues.go: Added UpdateIssueComment function and helper
  • pkg/github/issues_test.go: Added comprehensive test suite (5 test cases)
  • pkg/github/tools.go: Registered tool in issues toolset
  • pkg/github/__toolsnaps__/update_issue_comment.snap: Tool schema validation

Test Results

✅ TestUpdateIssueComment/success - Updates comment successfully
✅ TestUpdateIssueComment/not_found - Handles 404 responses gracefully  
✅ TestUpdateIssueComment/missing_parameters - Validates required parameters
✅ TestUpdateIssueComment/invalid_comment_id - Validates ID format
✅ TestUpdateIssueComment/empty_body - Prevents empty content

Test plan

  • Unit tests pass for new functionality
  • All existing tests continue to pass (no regressions)
  • Tool schema validation via snapshots
  • Manual testing with GitHub API responses
  • Parameter validation edge cases covered

Fixes #1083

🤖 Generated with Claude Code

Implement new MCP tool to update existing GitHub issue comments.

Features:
- Full parameter validation (comment_id, issue_number, owner, repo, body)
- Proper error handling for invalid IDs and empty content
- Comprehensive test coverage with 5 test cases
- Follows existing codebase patterns and conventions
- Uses GitHub's EditComment API for reliable updates

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@PreistlyPython PreistlyPython requested a review from a team as a code owner September 27, 2025 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add update_issue_comment tool
1 participant