Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit755b816

Browse files
AlexanderYastrebovwilliammartin
authored andcommitted
pkg/github: fix use of per page parameter
Page size tool parameter names were changed to `perPage` within#90while GitHub API uses `per_page` parameter name.This change fixes overlooked inconsistencies.Follow up on#90Follow up on#129Fixes#136Signed-off-by: Alexander Yastrebov <yastrebov.alex@gmail.com>
1 parente4c2f58 commit755b816

9 files changed

+38
-38
lines changed

‎README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
204204
-`sort`: Sort field (string, optional)
205205
-`order`: Sort order (string, optional)
206206
-`page`: Page number (number, optional)
207-
-`per_page`: Results per page (number, optional)
207+
-`perPage`: Results per page (number, optional)
208208

209209
###Pull Requests
210210

‎pkg/github/issues.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ func searchIssues(client *github.Client, t translations.TranslationHelperFunc) (
162162
mcp.Description("Sort order ('asc' or 'desc')"),
163163
mcp.Enum("asc","desc"),
164164
),
165-
mcp.WithNumber("per_page",
165+
mcp.WithNumber("perPage",
166166
mcp.Description("Results per page (max 100)"),
167167
mcp.Min(1),
168168
mcp.Max(100),
@@ -185,7 +185,7 @@ func searchIssues(client *github.Client, t translations.TranslationHelperFunc) (
185185
iferr!=nil {
186186
returnmcp.NewToolResultError(err.Error()),nil
187187
}
188-
perPage,err:=optionalIntParamWithDefault(request,"per_page",30)
188+
perPage,err:=optionalIntParamWithDefault(request,"perPage",30)
189189
iferr!=nil {
190190
returnmcp.NewToolResultError(err.Error()),nil
191191
}
@@ -378,7 +378,7 @@ func listIssues(client *github.Client, t translations.TranslationHelperFunc) (to
378378
mcp.WithNumber("page",
379379
mcp.Description("Page number"),
380380
),
381-
mcp.WithNumber("per_page",
381+
mcp.WithNumber("perPage",
382382
mcp.Description("Results per page"),
383383
),
384384
),
@@ -432,7 +432,7 @@ func listIssues(client *github.Client, t translations.TranslationHelperFunc) (to
432432
opts.Page=int(page)
433433
}
434434

435-
ifperPage,ok:=request.Params.Arguments["per_page"].(float64);ok {
435+
ifperPage,ok:=request.Params.Arguments["perPage"].(float64);ok {
436436
opts.PerPage=int(perPage)
437437
}
438438

‎pkg/github/issues_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ func Test_SearchIssues(t *testing.T) {
244244
assert.Contains(t,tool.InputSchema.Properties,"q")
245245
assert.Contains(t,tool.InputSchema.Properties,"sort")
246246
assert.Contains(t,tool.InputSchema.Properties,"order")
247-
assert.Contains(t,tool.InputSchema.Properties,"per_page")
247+
assert.Contains(t,tool.InputSchema.Properties,"perPage")
248248
assert.Contains(t,tool.InputSchema.Properties,"page")
249249
assert.ElementsMatch(t,tool.InputSchema.Required, []string{"q"})
250250

@@ -295,11 +295,11 @@ func Test_SearchIssues(t *testing.T) {
295295
),
296296
),
297297
requestArgs:map[string]interface{}{
298-
"q":"repo:owner/repo is:issue is:open",
299-
"sort":"created",
300-
"order":"desc",
301-
"page":float64(1),
302-
"per_page":float64(30),
298+
"q":"repo:owner/repo is:issue is:open",
299+
"sort":"created",
300+
"order":"desc",
301+
"page":float64(1),
302+
"perPage":float64(30),
303303
},
304304
expectError:false,
305305
expectedResult:mockSearchResult,
@@ -567,7 +567,7 @@ func Test_ListIssues(t *testing.T) {
567567
assert.Contains(t,tool.InputSchema.Properties,"direction")
568568
assert.Contains(t,tool.InputSchema.Properties,"since")
569569
assert.Contains(t,tool.InputSchema.Properties,"page")
570-
assert.Contains(t,tool.InputSchema.Properties,"per_page")
570+
assert.Contains(t,tool.InputSchema.Properties,"perPage")
571571
assert.ElementsMatch(t,tool.InputSchema.Required, []string{"owner","repo"})
572572

573573
// Setup mock issues for success case
@@ -641,7 +641,7 @@ func Test_ListIssues(t *testing.T) {
641641
"direction":"desc",
642642
"since":"2023-01-01T00:00:00Z",
643643
"page":float64(1),
644-
"per_page":float64(30),
644+
"perPage":float64(30),
645645
},
646646
expectError:false,
647647
expectedIssues:mockIssues,

‎pkg/github/pullrequests.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ func listPullRequests(client *github.Client, t translations.TranslationHelperFun
9494
mcp.WithString("direction",
9595
mcp.Description("Sort direction ('asc', 'desc')"),
9696
),
97-
mcp.WithNumber("per_page",
97+
mcp.WithNumber("perPage",
9898
mcp.Description("Results per page (max 100)"),
9999
),
100100
mcp.WithNumber("page",
@@ -130,7 +130,7 @@ func listPullRequests(client *github.Client, t translations.TranslationHelperFun
130130
iferr!=nil {
131131
returnmcp.NewToolResultError(err.Error()),nil
132132
}
133-
perPage,err:=optionalIntParamWithDefault(request,"per_page",30)
133+
perPage,err:=optionalIntParamWithDefault(request,"perPage",30)
134134
iferr!=nil {
135135
returnmcp.NewToolResultError(err.Error()),nil
136136
}

‎pkg/github/pullrequests_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ func Test_ListPullRequests(t *testing.T) {
140140
assert.Contains(t,tool.InputSchema.Properties,"base")
141141
assert.Contains(t,tool.InputSchema.Properties,"sort")
142142
assert.Contains(t,tool.InputSchema.Properties,"direction")
143-
assert.Contains(t,tool.InputSchema.Properties,"per_page")
143+
assert.Contains(t,tool.InputSchema.Properties,"perPage")
144144
assert.Contains(t,tool.InputSchema.Properties,"page")
145145
assert.ElementsMatch(t,tool.InputSchema.Required, []string{"owner","repo"})
146146

@@ -190,7 +190,7 @@ func Test_ListPullRequests(t *testing.T) {
190190
"state":"all",
191191
"sort":"created",
192192
"direction":"desc",
193-
"per_page":float64(30),
193+
"perPage":float64(30),
194194
"page":float64(1),
195195
},
196196
expectError:false,

‎pkg/github/repositories.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ func listCommits(client *github.Client, t translations.TranslationHelperFunc) (t
5252
iferr!=nil {
5353
returnmcp.NewToolResultError(err.Error()),nil
5454
}
55-
perPage,err:=optionalIntParamWithDefault(request,"per_page",30)
55+
perPage,err:=optionalIntParamWithDefault(request,"perPage",30)
5656
iferr!=nil {
5757
returnmcp.NewToolResultError(err.Error()),nil
5858
}

‎pkg/github/repositories_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -582,10 +582,10 @@ func Test_ListCommits(t *testing.T) {
582582
),
583583
),
584584
requestArgs:map[string]interface{}{
585-
"owner":"owner",
586-
"repo":"repo",
587-
"page":float64(2),
588-
"per_page":float64(10),
585+
"owner":"owner",
586+
"repo":"repo",
587+
"page":float64(2),
588+
"perPage":float64(10),
589589
},
590590
expectError:false,
591591
expectedCommits:mockCommits,

‎pkg/github/search.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func searchCode(client *github.Client, t translations.TranslationHelperFunc) (to
8686
mcp.Description("Sort order ('asc' or 'desc')"),
8787
mcp.Enum("asc","desc"),
8888
),
89-
mcp.WithNumber("per_page",
89+
mcp.WithNumber("perPage",
9090
mcp.Description("Results per page (max 100)"),
9191
mcp.Min(1),
9292
mcp.Max(100),
@@ -109,7 +109,7 @@ func searchCode(client *github.Client, t translations.TranslationHelperFunc) (to
109109
iferr!=nil {
110110
returnmcp.NewToolResultError(err.Error()),nil
111111
}
112-
perPage,err:=optionalIntParamWithDefault(request,"per_page",30)
112+
perPage,err:=optionalIntParamWithDefault(request,"perPage",30)
113113
iferr!=nil {
114114
returnmcp.NewToolResultError(err.Error()),nil
115115
}
@@ -166,7 +166,7 @@ func searchUsers(client *github.Client, t translations.TranslationHelperFunc) (t
166166
mcp.Description("Sort order ('asc' or 'desc')"),
167167
mcp.Enum("asc","desc"),
168168
),
169-
mcp.WithNumber("per_page",
169+
mcp.WithNumber("perPage",
170170
mcp.Description("Results per page (max 100)"),
171171
mcp.Min(1),
172172
mcp.Max(100),
@@ -189,7 +189,7 @@ func searchUsers(client *github.Client, t translations.TranslationHelperFunc) (t
189189
iferr!=nil {
190190
returnmcp.NewToolResultError(err.Error()),nil
191191
}
192-
perPage,err:=optionalIntParamWithDefault(request,"per_page",30)
192+
perPage,err:=optionalIntParamWithDefault(request,"perPage",30)
193193
iferr!=nil {
194194
returnmcp.NewToolResultError(err.Error()),nil
195195
}

‎pkg/github/search_test.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ func Test_SearchCode(t *testing.T) {
170170
assert.Contains(t,tool.InputSchema.Properties,"q")
171171
assert.Contains(t,tool.InputSchema.Properties,"sort")
172172
assert.Contains(t,tool.InputSchema.Properties,"order")
173-
assert.Contains(t,tool.InputSchema.Properties,"per_page")
173+
assert.Contains(t,tool.InputSchema.Properties,"perPage")
174174
assert.Contains(t,tool.InputSchema.Properties,"page")
175175
assert.ElementsMatch(t,tool.InputSchema.Required, []string{"q"})
176176

@@ -221,11 +221,11 @@ func Test_SearchCode(t *testing.T) {
221221
),
222222
),
223223
requestArgs:map[string]interface{}{
224-
"q":"fmt.Println language:go",
225-
"sort":"indexed",
226-
"order":"desc",
227-
"page":float64(1),
228-
"per_page":float64(30),
224+
"q":"fmt.Println language:go",
225+
"sort":"indexed",
226+
"order":"desc",
227+
"page":float64(1),
228+
"perPage":float64(30),
229229
},
230230
expectError:false,
231231
expectedResult:mockSearchResult,
@@ -321,7 +321,7 @@ func Test_SearchUsers(t *testing.T) {
321321
assert.Contains(t,tool.InputSchema.Properties,"q")
322322
assert.Contains(t,tool.InputSchema.Properties,"sort")
323323
assert.Contains(t,tool.InputSchema.Properties,"order")
324-
assert.Contains(t,tool.InputSchema.Properties,"per_page")
324+
assert.Contains(t,tool.InputSchema.Properties,"perPage")
325325
assert.Contains(t,tool.InputSchema.Properties,"page")
326326
assert.ElementsMatch(t,tool.InputSchema.Required, []string{"q"})
327327

@@ -376,11 +376,11 @@ func Test_SearchUsers(t *testing.T) {
376376
),
377377
),
378378
requestArgs:map[string]interface{}{
379-
"q":"location:finland language:go",
380-
"sort":"followers",
381-
"order":"desc",
382-
"page":float64(1),
383-
"per_page":float64(30),
379+
"q":"location:finland language:go",
380+
"sort":"followers",
381+
"order":"desc",
382+
"page":float64(1),
383+
"perPage":float64(30),
384384
},
385385
expectError:false,
386386
expectedResult:mockSearchResult,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp