From 1e7314975d165d2a0758af89aa24789396a81222 Mon Sep 17 00:00:00 2001 From: majiayu000 <1835304752@qq.com> Date: Tue, 30 Dec 2025 21:31:24 +0800 Subject: [PATCH 1/2] 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 <1835304752@qq.com> --- .../assign_copilot_to_issue.snap | 14 +++++----- pkg/github/issues.go | 10 +++---- pkg/github/issues_test.go | 28 +++++++++---------- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/pkg/github/__toolsnaps__/assign_copilot_to_issue.snap b/pkg/github/__toolsnaps__/assign_copilot_to_issue.snap index 22c380055..354600147 100644 --- a/pkg/github/__toolsnaps__/assign_copilot_to_issue.snap +++ b/pkg/github/__toolsnaps__/assign_copilot_to_issue.snap @@ -6,13 +6,8 @@ "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", "inputSchema": { "type": "object", - "required": [ - "owner", - "repo", - "issueNumber" - ], "properties": { - "issueNumber": { + "issue_number": { "type": "number", "description": "Issue number" }, @@ -24,7 +19,12 @@ "type": "string", "description": "Repository name" } - } + }, + "required": [ + "owner", + "repo", + "issue_number" + ] }, "name": "assign_copilot_to_issue", "icons": [ diff --git a/pkg/github/issues.go b/pkg/github/issues.go index f06dc2d9d..626e2c2e9 100644 --- a/pkg/github/issues.go +++ b/pkg/github/issues.go @@ -1626,19 +1626,19 @@ func AssignCopilotToIssue(t translations.TranslationHelperFunc) inventory.Server Type: "string", Description: "Repository name", }, - "issueNumber": { + "issue_number": { Type: "number", Description: "Issue number", }, }, - Required: []string{"owner", "repo", "issueNumber"}, + Required: []string{"owner", "repo", "issue_number"}, }, }, func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) { var params struct { - Owner string - Repo string - IssueNumber int32 + Owner string `mapstructure:"owner"` + Repo string `mapstructure:"repo"` + IssueNumber int32 `mapstructure:"issue_number"` } if err := mapstructure.Decode(args, ¶ms); err != nil { return utils.NewToolResultError(err.Error()), nil, nil diff --git a/pkg/github/issues_test.go b/pkg/github/issues_test.go index b810cede3..694b991dc 100644 --- a/pkg/github/issues_test.go +++ b/pkg/github/issues_test.go @@ -2175,8 +2175,8 @@ func TestAssignCopilotToIssue(t *testing.T) { assert.NotEmpty(t, tool.Description) assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "owner") assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "repo") - assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "issueNumber") - assert.ElementsMatch(t, tool.InputSchema.(*jsonschema.Schema).Required, []string{"owner", "repo", "issueNumber"}) + assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "issue_number") + assert.ElementsMatch(t, tool.InputSchema.(*jsonschema.Schema).Required, []string{"owner", "repo", "issue_number"}) var pageOfFakeBots = func(n int) []struct{} { // 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) { { name: "successful assignment when there are no existing assignees", requestArgs: map[string]any{ - "owner": "owner", - "repo": "repo", - "issueNumber": float64(123), + "owner": "owner", + "repo": "repo", + "issue_number": float64(123), }, mockedClient: githubv4mock.NewMockedHTTPClient( githubv4mock.NewQueryMatcher( @@ -2286,9 +2286,9 @@ func TestAssignCopilotToIssue(t *testing.T) { { name: "successful assignment when there are existing assignees", requestArgs: map[string]any{ - "owner": "owner", - "repo": "repo", - "issueNumber": float64(123), + "owner": "owner", + "repo": "repo", + "issue_number": float64(123), }, mockedClient: githubv4mock.NewMockedHTTPClient( githubv4mock.NewQueryMatcher( @@ -2386,9 +2386,9 @@ func TestAssignCopilotToIssue(t *testing.T) { { name: "copilot bot not on first page of suggested actors", requestArgs: map[string]any{ - "owner": "owner", - "repo": "repo", - "issueNumber": float64(123), + "owner": "owner", + "repo": "repo", + "issue_number": float64(123), }, mockedClient: githubv4mock.NewMockedHTTPClient( // First page of suggested actors @@ -2512,9 +2512,9 @@ func TestAssignCopilotToIssue(t *testing.T) { { name: "copilot not a suggested actor", requestArgs: map[string]any{ - "owner": "owner", - "repo": "repo", - "issueNumber": float64(123), + "owner": "owner", + "repo": "repo", + "issue_number": float64(123), }, mockedClient: githubv4mock.NewMockedHTTPClient( githubv4mock.NewQueryMatcher( From abeeb660071019288d2fd1ed7d922ee7a711fd7a Mon Sep 17 00:00:00 2001 From: lif <1835304752@qq.com> Date: Wed, 31 Dec 2025 23:28:45 +0800 Subject: [PATCH 2/2] docs: regenerate README after parameter rename Update auto-generated documentation to reflect the issueNumber -> issue_number parameter rename in assign_copilot_to_issue tool. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8ab95c8dc..29795dc8f 100644 --- a/README.md +++ b/README.md @@ -758,7 +758,7 @@ The following sets of tools are available: - `repo`: Repository name (string, required) - **assign_copilot_to_issue** - Assign Copilot to issue - - `issueNumber`: Issue number (number, required) + - `issue_number`: Issue number (number, required) - `owner`: Repository owner (string, required) - `repo`: Repository name (string, required)