Skip to content

Commit 2cc6911

Browse files
majiayu000SamMorrowDrums
authored andcommitted
refactor: use consistent snake_case for issue_number parameter
Change the parameter name in assign_copilot_to_issue tool from 'issueNumber' (camelCase) to 'issue_number' (snake_case) to match the naming convention used by all other tools in the issues toolset. This improves API consistency and makes the tool parameters more predictable for users and AI models. Fixes #1239 Signed-off-by: majiayu000 <[email protected]>
1 parent 953d26f commit 2cc6911

File tree

3 files changed

+26
-26
lines changed

3 files changed

+26
-26
lines changed

pkg/github/__toolsnaps__/assign_copilot_to_issue.snap

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,8 @@
66
"description": "Assign Copilot to a specific issue in a GitHub repository.\n\nThis tool can help with the following outcomes:\n- a Pull Request created with source code changes to resolve the issue\n\n\nMore information can be found at:\n- https://docs.github.com/en/copilot/using-github-copilot/using-copilot-coding-agent-to-work-on-tasks/about-assigning-tasks-to-copilot\n",
77
"inputSchema": {
88
"type": "object",
9-
"required": [
10-
"owner",
11-
"repo",
12-
"issueNumber"
13-
],
149
"properties": {
15-
"issueNumber": {
10+
"issue_number": {
1611
"type": "number",
1712
"description": "Issue number"
1813
},
@@ -24,7 +19,12 @@
2419
"type": "string",
2520
"description": "Repository name"
2621
}
27-
}
22+
},
23+
"required": [
24+
"owner",
25+
"repo",
26+
"issue_number"
27+
]
2828
},
2929
"name": "assign_copilot_to_issue",
3030
"icons": [

pkg/github/issues.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1626,19 +1626,19 @@ func AssignCopilotToIssue(t translations.TranslationHelperFunc) inventory.Server
16261626
Type: "string",
16271627
Description: "Repository name",
16281628
},
1629-
"issueNumber": {
1629+
"issue_number": {
16301630
Type: "number",
16311631
Description: "Issue number",
16321632
},
16331633
},
1634-
Required: []string{"owner", "repo", "issueNumber"},
1634+
Required: []string{"owner", "repo", "issue_number"},
16351635
},
16361636
},
16371637
func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
16381638
var params struct {
1639-
Owner string
1640-
Repo string
1641-
IssueNumber int32
1639+
Owner string `mapstructure:"owner"`
1640+
Repo string `mapstructure:"repo"`
1641+
IssueNumber int32 `mapstructure:"issue_number"`
16421642
}
16431643
if err := mapstructure.Decode(args, &params); err != nil {
16441644
return utils.NewToolResultError(err.Error()), nil, nil

pkg/github/issues_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2175,8 +2175,8 @@ func TestAssignCopilotToIssue(t *testing.T) {
21752175
assert.NotEmpty(t, tool.Description)
21762176
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "owner")
21772177
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "repo")
2178-
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "issueNumber")
2179-
assert.ElementsMatch(t, tool.InputSchema.(*jsonschema.Schema).Required, []string{"owner", "repo", "issueNumber"})
2178+
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "issue_number")
2179+
assert.ElementsMatch(t, tool.InputSchema.(*jsonschema.Schema).Required, []string{"owner", "repo", "issue_number"})
21802180

21812181
var pageOfFakeBots = func(n int) []struct{} {
21822182
// We don't _really_ need real bots here, just objects that count as entries for the page
@@ -2197,9 +2197,9 @@ func TestAssignCopilotToIssue(t *testing.T) {
21972197
{
21982198
name: "successful assignment when there are no existing assignees",
21992199
requestArgs: map[string]any{
2200-
"owner": "owner",
2201-
"repo": "repo",
2202-
"issueNumber": float64(123),
2200+
"owner": "owner",
2201+
"repo": "repo",
2202+
"issue_number": float64(123),
22032203
},
22042204
mockedClient: githubv4mock.NewMockedHTTPClient(
22052205
githubv4mock.NewQueryMatcher(
@@ -2286,9 +2286,9 @@ func TestAssignCopilotToIssue(t *testing.T) {
22862286
{
22872287
name: "successful assignment when there are existing assignees",
22882288
requestArgs: map[string]any{
2289-
"owner": "owner",
2290-
"repo": "repo",
2291-
"issueNumber": float64(123),
2289+
"owner": "owner",
2290+
"repo": "repo",
2291+
"issue_number": float64(123),
22922292
},
22932293
mockedClient: githubv4mock.NewMockedHTTPClient(
22942294
githubv4mock.NewQueryMatcher(
@@ -2386,9 +2386,9 @@ func TestAssignCopilotToIssue(t *testing.T) {
23862386
{
23872387
name: "copilot bot not on first page of suggested actors",
23882388
requestArgs: map[string]any{
2389-
"owner": "owner",
2390-
"repo": "repo",
2391-
"issueNumber": float64(123),
2389+
"owner": "owner",
2390+
"repo": "repo",
2391+
"issue_number": float64(123),
23922392
},
23932393
mockedClient: githubv4mock.NewMockedHTTPClient(
23942394
// First page of suggested actors
@@ -2512,9 +2512,9 @@ func TestAssignCopilotToIssue(t *testing.T) {
25122512
{
25132513
name: "copilot not a suggested actor",
25142514
requestArgs: map[string]any{
2515-
"owner": "owner",
2516-
"repo": "repo",
2517-
"issueNumber": float64(123),
2515+
"owner": "owner",
2516+
"repo": "repo",
2517+
"issue_number": float64(123),
25182518
},
25192519
mockedClient: githubv4mock.NewMockedHTTPClient(
25202520
githubv4mock.NewQueryMatcher(

0 commit comments

Comments
 (0)