Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
fa69f90
Add reaction tools for issues and pull requests
timrogers Jun 19, 2026
a5511ca
Make reaction tools available in both granular and non-granular modes
timrogers Jun 19, 2026
774b75b
Update toolsnaps with aligned reaction tool descriptions
timrogers Jun 19, 2026
94c6f2c
Align reaction tool descriptions with codebase style
timrogers Jun 19, 2026
30da9da
Improve reaction tool responses and wording
timrogers Jun 19, 2026
009bb7b
Expose reactions through default comment tools
SamMorrowDrums Jun 23, 2026
e6276cf
Clarify PR review comment IDs for reactions
SamMorrowDrums Jun 23, 2026
7c53cde
Support issue comment reactions in add_issue_comment
SamMorrowDrums Jun 23, 2026
9908fbf
Merge branch 'main' into timrogers/planning-reaction-tools
SamMorrowDrums Jun 23, 2026
2c9410b
Harden combined comment reaction tools
SamMorrowDrums Jun 23, 2026
d218ebe
Group reaction tools with granular registrations
SamMorrowDrums Jun 23, 2026
7fff6f2
Align granular reaction tool constructors
SamMorrowDrums Jun 23, 2026
9855c06
Require issue number for comment reactions
SamMorrowDrums Jun 24, 2026
b0d11b0
Address issue comment feedback
SamMorrowDrums Jun 26, 2026
ca55793
Merge branch 'main' into timrogers/planning-reaction-tools
SamMorrowDrums Jun 26, 2026
e522c77
Validate issue comment reaction target
SamMorrowDrums Jun 26, 2026
ea14878
Validate positive comment IDs
SamMorrowDrums Jun 26, 2026
95737a9
Merge remote-tracking branch 'origin/main' into pr/2732/timrogers/pla…
SamMorrowDrums Jun 26, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Require issue number for comment reactions
Make issue_number required on the consolidated add_issue_comment tool even when reacting to a specific issue comment, keeping the default tool input shape explicit.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
  • Loading branch information
SamMorrowDrums and Copilot committed Jun 24, 2026
commit 9855c065dcdd3915db6d25cafabca1ee6101bd6d
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ The following sets of tools are available:
- **Required OAuth Scopes**: `repo`
- `body`: Comment content. Required unless reaction is provided. (string, optional)
- `comment_id`: The numeric ID of the issue or pull request comment to react to. Use this for reactions to comments; omit it to react to the issue or pull request itself. (number, optional)
- `issue_number`: Issue or pull request number to comment on or react to. Required when body is provided, or when reaction targets an issue or pull request. (number, optional)
- `issue_number`: Issue or pull request number to comment on or react to. (number, required)
- `owner`: Repository owner (string, required)
- `reaction`: Emoji reaction to add. Required unless body is provided. (string, optional)
- `repo`: Repository name (string, required)
Expand Down
5 changes: 3 additions & 2 deletions pkg/github/__toolsnaps__/add_issue_comment.snap
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"type": "number"
},
"issue_number": {
"description": "Issue or pull request number to comment on or react to. Required when body is provided, or when reaction targets an issue or pull request.",
"description": "Issue or pull request number to comment on or react to.",
"type": "number"
},
"owner": {
Expand Down Expand Up @@ -43,7 +43,8 @@
},
"required": [
"owner",
"repo"
"repo",
"issue_number"
],
"type": "object"
},
Expand Down
21 changes: 5 additions & 16 deletions pkg/github/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -1125,7 +1125,7 @@ func AddIssueComment(t translations.TranslationHelperFunc) inventory.ServerTool
},
"issue_number": {
Type: "number",
Description: "Issue or pull request number to comment on or react to. Required when body is provided, or when reaction targets an issue or pull request.",
Description: "Issue or pull request number to comment on or react to.",
},
"comment_id": {
Type: "number",
Expand All @@ -1142,7 +1142,7 @@ func AddIssueComment(t translations.TranslationHelperFunc) inventory.ServerTool
Enum: []any{"+1", "-1", "laugh", "confused", "heart", "hooray", "rocket", "eyes"},
},
},
Required: []string{"owner", "repo"},
Required: []string{"owner", "repo", "issue_number"},
},
Comment thread
SamMorrowDrums marked this conversation as resolved.
},
[]scopes.Scope{scopes.Repo},
Expand All @@ -1155,14 +1155,9 @@ func AddIssueComment(t translations.TranslationHelperFunc) inventory.ServerTool
if err != nil {
return utils.NewToolResultError(err.Error()), nil, nil
}
var issueNumber int
hasIssueNumber := false
if _, ok := args["issue_number"]; ok {
issueNumber, err = RequiredInt(args, "issue_number")
if err != nil {
return utils.NewToolResultError(err.Error()), nil, nil
}
hasIssueNumber = true
issueNumber, err := RequiredInt(args, "issue_number")
if err != nil {
return utils.NewToolResultError(err.Error()), nil, nil
}
var commentID int64
hasCommentID := false
Expand All @@ -1184,12 +1179,6 @@ func AddIssueComment(t translations.TranslationHelperFunc) inventory.ServerTool
if !hasBody && !hasReaction {
return utils.NewToolResultError("at least one of body or reaction is required"), nil, nil
}
if hasBody && !hasIssueNumber {
return utils.NewToolResultError("issue_number is required when body is provided"), nil, nil
}
if hasReaction && !hasIssueNumber && !hasCommentID {
return utils.NewToolResultError("issue_number or comment_id is required when reaction is provided"), nil, nil
}
if hasCommentID && !hasReaction {
return utils.NewToolResultError("comment_id can only be provided when reaction is provided"), nil, nil
}
Expand Down
19 changes: 10 additions & 9 deletions pkg/github/issues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@ func Test_AddIssueComment(t *testing.T) {
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "comment_id")
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "body")
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "reaction")
assert.ElementsMatch(t, tool.InputSchema.(*jsonschema.Schema).Required, []string{"owner", "repo"})
assert.ElementsMatch(t, tool.InputSchema.(*jsonschema.Schema).Required, []string{"owner", "repo", "issue_number"})

// Setup mock comment for success case
mockComment := &github.IssueComment{
Expand Down Expand Up @@ -4312,7 +4312,7 @@ func TestAddIssueComment(t *testing.T) {
assert.Contains(t, schema.Properties, "comment_id")
assert.Contains(t, schema.Properties, "body")
assert.Contains(t, schema.Properties, "reaction")
assert.ElementsMatch(t, schema.Required, []string{"owner", "repo"})
assert.ElementsMatch(t, schema.Required, []string{"owner", "repo", "issue_number"})

Comment thread
SamMorrowDrums marked this conversation as resolved.
mockComment := &github.IssueComment{
ID: github.Ptr(int64(456)),
Expand Down Expand Up @@ -4363,10 +4363,11 @@ func TestAddIssueComment(t *testing.T) {
PostReposIssuesCommentsReactionsByOwnerByRepoByCommentID: mockResponse(t, http.StatusCreated, mockReaction),
}),
requestArgs: map[string]any{
"owner": "owner",
"repo": "repo",
"comment_id": float64(999),
"reaction": "heart",
"owner": "owner",
"repo": "repo",
"issue_number": float64(42),
"comment_id": float64(999),
"reaction": "heart",
},
},
{
Expand Down Expand Up @@ -4394,14 +4395,14 @@ func TestAddIssueComment(t *testing.T) {
expectedToolErrMsg: "at least one of body or reaction is required",
},
{
name: "missing target for reaction",
name: "missing issue_number for reaction",
requestArgs: map[string]any{
"owner": "owner",
"repo": "repo",
"reaction": "heart",
},
expectToolError: true,
expectedToolErrMsg: "issue_number or comment_id is required when reaction is provided",
expectedToolErrMsg: "missing required parameter: issue_number",
},
{
name: "missing issue_number for body",
Expand All @@ -4411,7 +4412,7 @@ func TestAddIssueComment(t *testing.T) {
"body": "This is a comment",
},
expectToolError: true,
expectedToolErrMsg: "issue_number is required when body is provided",
expectedToolErrMsg: "missing required parameter: issue_number",
},
{
name: "comment_id without reaction",
Expand Down
Loading