Skip to content

Commit e4ae809

Browse files
chore: export pr funcs
1 parent f4770fa commit e4ae809

File tree

3 files changed

+50
-50
lines changed

3 files changed

+50
-50
lines changed

pkg/github/pullrequests.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
"github.com/mark3labs/mcp-go/server"
1414
)
1515

16-
// getPullRequest creates a tool to get details of a specific pull request.
17-
func getPullRequest(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
16+
// GetPullRequest creates a tool to get details of a specific pull request.
17+
func GetPullRequest(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
1818
return mcp.NewTool("get_pull_request",
1919
mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_DESCRIPTION", "Get details of a specific pull request")),
2020
mcp.WithString("owner",
@@ -67,8 +67,8 @@ func getPullRequest(client *github.Client, t translations.TranslationHelperFunc)
6767
}
6868
}
6969

70-
// listPullRequests creates a tool to list and filter repository pull requests.
71-
func listPullRequests(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
70+
// ListPullRequests creates a tool to list and filter repository pull requests.
71+
func ListPullRequests(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
7272
return mcp.NewTool("list_pull_requests",
7373
mcp.WithDescription(t("TOOL_LIST_PULL_REQUESTS_DESCRIPTION", "List and filter repository pull requests")),
7474
mcp.WithString("owner",
@@ -165,8 +165,8 @@ func listPullRequests(client *github.Client, t translations.TranslationHelperFun
165165
}
166166
}
167167

168-
// mergePullRequest creates a tool to merge a pull request.
169-
func mergePullRequest(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
168+
// MergePullRequest creates a tool to merge a pull request.
169+
func MergePullRequest(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
170170
return mcp.NewTool("merge_pull_request",
171171
mcp.WithDescription(t("TOOL_MERGE_PULL_REQUEST_DESCRIPTION", "Merge a pull request")),
172172
mcp.WithString("owner",
@@ -245,8 +245,8 @@ func mergePullRequest(client *github.Client, t translations.TranslationHelperFun
245245
}
246246
}
247247

248-
// getPullRequestFiles creates a tool to get the list of files changed in a pull request.
249-
func getPullRequestFiles(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
248+
// GetPullRequestFiles creates a tool to get the list of files changed in a pull request.
249+
func GetPullRequestFiles(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
250250
return mcp.NewTool("get_pull_request_files",
251251
mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_FILES_DESCRIPTION", "Get the list of files changed in a pull request")),
252252
mcp.WithString("owner",
@@ -300,8 +300,8 @@ func getPullRequestFiles(client *github.Client, t translations.TranslationHelper
300300
}
301301
}
302302

303-
// getPullRequestStatus creates a tool to get the combined status of all status checks for a pull request.
304-
func getPullRequestStatus(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
303+
// GetPullRequestStatus creates a tool to get the combined status of all status checks for a pull request.
304+
func GetPullRequestStatus(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
305305
return mcp.NewTool("get_pull_request_status",
306306
mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_STATUS_DESCRIPTION", "Get the combined status of all status checks for a pull request")),
307307
mcp.WithString("owner",
@@ -369,8 +369,8 @@ func getPullRequestStatus(client *github.Client, t translations.TranslationHelpe
369369
}
370370
}
371371

372-
// updatePullRequestBranch creates a tool to update a pull request branch with the latest changes from the base branch.
373-
func updatePullRequestBranch(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
372+
// UpdatePullRequestBranch creates a tool to update a pull request branch with the latest changes from the base branch.
373+
func UpdatePullRequestBranch(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
374374
return mcp.NewTool("update_pull_request_branch",
375375
mcp.WithDescription(t("TOOL_UPDATE_PULL_REQUEST_BRANCH_DESCRIPTION", "Update a pull request branch with the latest changes from the base branch")),
376376
mcp.WithString("owner",
@@ -439,8 +439,8 @@ func updatePullRequestBranch(client *github.Client, t translations.TranslationHe
439439
}
440440
}
441441

442-
// getPullRequestComments creates a tool to get the review comments on a pull request.
443-
func getPullRequestComments(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
442+
// GetPullRequestComments creates a tool to get the review comments on a pull request.
443+
func GetPullRequestComments(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
444444
return mcp.NewTool("get_pull_request_comments",
445445
mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_COMMENTS_DESCRIPTION", "Get the review comments on a pull request")),
446446
mcp.WithString("owner",
@@ -499,8 +499,8 @@ func getPullRequestComments(client *github.Client, t translations.TranslationHel
499499
}
500500
}
501501

502-
// getPullRequestReviews creates a tool to get the reviews on a pull request.
503-
func getPullRequestReviews(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
502+
// GetPullRequestReviews creates a tool to get the reviews on a pull request.
503+
func GetPullRequestReviews(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
504504
return mcp.NewTool("get_pull_request_reviews",
505505
mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_REVIEWS_DESCRIPTION", "Get the reviews on a pull request")),
506506
mcp.WithString("owner",
@@ -553,8 +553,8 @@ func getPullRequestReviews(client *github.Client, t translations.TranslationHelp
553553
}
554554
}
555555

556-
// createPullRequestReview creates a tool to submit a review on a pull request.
557-
func createPullRequestReview(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
556+
// CreatePullRequestReview creates a tool to submit a review on a pull request.
557+
func CreatePullRequestReview(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
558558
return mcp.NewTool("create_pull_request_review",
559559
mcp.WithDescription(t("TOOL_CREATE_PULL_REQUEST_REVIEW_DESCRIPTION", "Create a review on a pull request")),
560560
mcp.WithString("owner",
@@ -745,8 +745,8 @@ func createPullRequestReview(client *github.Client, t translations.TranslationHe
745745
}
746746
}
747747

748-
// createPullRequest creates a tool to create a new pull request.
749-
func createPullRequest(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
748+
// CreatePullRequest creates a tool to create a new pull request.
749+
func CreatePullRequest(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
750750
return mcp.NewTool("create_pull_request",
751751
mcp.WithDescription(t("TOOL_CREATE_PULL_REQUEST_DESCRIPTION", "Create a new pull request in a GitHub repository")),
752752
mcp.WithString("owner",

pkg/github/pullrequests_test.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import (
1717
func Test_GetPullRequest(t *testing.T) {
1818
// Verify tool definition once
1919
mockClient := github.NewClient(nil)
20-
tool, _ := getPullRequest(mockClient, translations.NullTranslationHelper)
20+
tool, _ := GetPullRequest(mockClient, translations.NullTranslationHelper)
2121

2222
assert.Equal(t, "get_pull_request", tool.Name)
2323
assert.NotEmpty(t, tool.Description)
@@ -94,7 +94,7 @@ func Test_GetPullRequest(t *testing.T) {
9494
t.Run(tc.name, func(t *testing.T) {
9595
// Setup client with mock
9696
client := github.NewClient(tc.mockedClient)
97-
_, handler := getPullRequest(client, translations.NullTranslationHelper)
97+
_, handler := GetPullRequest(client, translations.NullTranslationHelper)
9898

9999
// Create call request
100100
request := createMCPRequest(tc.requestArgs)
@@ -129,7 +129,7 @@ func Test_GetPullRequest(t *testing.T) {
129129
func Test_ListPullRequests(t *testing.T) {
130130
// Verify tool definition once
131131
mockClient := github.NewClient(nil)
132-
tool, _ := listPullRequests(mockClient, translations.NullTranslationHelper)
132+
tool, _ := ListPullRequests(mockClient, translations.NullTranslationHelper)
133133

134134
assert.Equal(t, "list_pull_requests", tool.Name)
135135
assert.NotEmpty(t, tool.Description)
@@ -221,7 +221,7 @@ func Test_ListPullRequests(t *testing.T) {
221221
t.Run(tc.name, func(t *testing.T) {
222222
// Setup client with mock
223223
client := github.NewClient(tc.mockedClient)
224-
_, handler := listPullRequests(client, translations.NullTranslationHelper)
224+
_, handler := ListPullRequests(client, translations.NullTranslationHelper)
225225

226226
// Create call request
227227
request := createMCPRequest(tc.requestArgs)
@@ -259,7 +259,7 @@ func Test_ListPullRequests(t *testing.T) {
259259
func Test_MergePullRequest(t *testing.T) {
260260
// Verify tool definition once
261261
mockClient := github.NewClient(nil)
262-
tool, _ := mergePullRequest(mockClient, translations.NullTranslationHelper)
262+
tool, _ := MergePullRequest(mockClient, translations.NullTranslationHelper)
263263

264264
assert.Equal(t, "merge_pull_request", tool.Name)
265265
assert.NotEmpty(t, tool.Description)
@@ -336,7 +336,7 @@ func Test_MergePullRequest(t *testing.T) {
336336
t.Run(tc.name, func(t *testing.T) {
337337
// Setup client with mock
338338
client := github.NewClient(tc.mockedClient)
339-
_, handler := mergePullRequest(client, translations.NullTranslationHelper)
339+
_, handler := MergePullRequest(client, translations.NullTranslationHelper)
340340

341341
// Create call request
342342
request := createMCPRequest(tc.requestArgs)
@@ -370,7 +370,7 @@ func Test_MergePullRequest(t *testing.T) {
370370
func Test_GetPullRequestFiles(t *testing.T) {
371371
// Verify tool definition once
372372
mockClient := github.NewClient(nil)
373-
tool, _ := getPullRequestFiles(mockClient, translations.NullTranslationHelper)
373+
tool, _ := GetPullRequestFiles(mockClient, translations.NullTranslationHelper)
374374

375375
assert.Equal(t, "get_pull_request_files", tool.Name)
376376
assert.NotEmpty(t, tool.Description)
@@ -448,7 +448,7 @@ func Test_GetPullRequestFiles(t *testing.T) {
448448
t.Run(tc.name, func(t *testing.T) {
449449
// Setup client with mock
450450
client := github.NewClient(tc.mockedClient)
451-
_, handler := getPullRequestFiles(client, translations.NullTranslationHelper)
451+
_, handler := GetPullRequestFiles(client, translations.NullTranslationHelper)
452452

453453
// Create call request
454454
request := createMCPRequest(tc.requestArgs)
@@ -486,7 +486,7 @@ func Test_GetPullRequestFiles(t *testing.T) {
486486
func Test_GetPullRequestStatus(t *testing.T) {
487487
// Verify tool definition once
488488
mockClient := github.NewClient(nil)
489-
tool, _ := getPullRequestStatus(mockClient, translations.NullTranslationHelper)
489+
tool, _ := GetPullRequestStatus(mockClient, translations.NullTranslationHelper)
490490

491491
assert.Equal(t, "get_pull_request_status", tool.Name)
492492
assert.NotEmpty(t, tool.Description)
@@ -608,7 +608,7 @@ func Test_GetPullRequestStatus(t *testing.T) {
608608
t.Run(tc.name, func(t *testing.T) {
609609
// Setup client with mock
610610
client := github.NewClient(tc.mockedClient)
611-
_, handler := getPullRequestStatus(client, translations.NullTranslationHelper)
611+
_, handler := GetPullRequestStatus(client, translations.NullTranslationHelper)
612612

613613
// Create call request
614614
request := createMCPRequest(tc.requestArgs)
@@ -647,7 +647,7 @@ func Test_GetPullRequestStatus(t *testing.T) {
647647
func Test_UpdatePullRequestBranch(t *testing.T) {
648648
// Verify tool definition once
649649
mockClient := github.NewClient(nil)
650-
tool, _ := updatePullRequestBranch(mockClient, translations.NullTranslationHelper)
650+
tool, _ := UpdatePullRequestBranch(mockClient, translations.NullTranslationHelper)
651651

652652
assert.Equal(t, "update_pull_request_branch", tool.Name)
653653
assert.NotEmpty(t, tool.Description)
@@ -735,7 +735,7 @@ func Test_UpdatePullRequestBranch(t *testing.T) {
735735
t.Run(tc.name, func(t *testing.T) {
736736
// Setup client with mock
737737
client := github.NewClient(tc.mockedClient)
738-
_, handler := updatePullRequestBranch(client, translations.NullTranslationHelper)
738+
_, handler := UpdatePullRequestBranch(client, translations.NullTranslationHelper)
739739

740740
// Create call request
741741
request := createMCPRequest(tc.requestArgs)
@@ -763,7 +763,7 @@ func Test_UpdatePullRequestBranch(t *testing.T) {
763763
func Test_GetPullRequestComments(t *testing.T) {
764764
// Verify tool definition once
765765
mockClient := github.NewClient(nil)
766-
tool, _ := getPullRequestComments(mockClient, translations.NullTranslationHelper)
766+
tool, _ := GetPullRequestComments(mockClient, translations.NullTranslationHelper)
767767

768768
assert.Equal(t, "get_pull_request_comments", tool.Name)
769769
assert.NotEmpty(t, tool.Description)
@@ -851,7 +851,7 @@ func Test_GetPullRequestComments(t *testing.T) {
851851
t.Run(tc.name, func(t *testing.T) {
852852
// Setup client with mock
853853
client := github.NewClient(tc.mockedClient)
854-
_, handler := getPullRequestComments(client, translations.NullTranslationHelper)
854+
_, handler := GetPullRequestComments(client, translations.NullTranslationHelper)
855855

856856
// Create call request
857857
request := createMCPRequest(tc.requestArgs)
@@ -890,7 +890,7 @@ func Test_GetPullRequestComments(t *testing.T) {
890890
func Test_GetPullRequestReviews(t *testing.T) {
891891
// Verify tool definition once
892892
mockClient := github.NewClient(nil)
893-
tool, _ := getPullRequestReviews(mockClient, translations.NullTranslationHelper)
893+
tool, _ := GetPullRequestReviews(mockClient, translations.NullTranslationHelper)
894894

895895
assert.Equal(t, "get_pull_request_reviews", tool.Name)
896896
assert.NotEmpty(t, tool.Description)
@@ -974,7 +974,7 @@ func Test_GetPullRequestReviews(t *testing.T) {
974974
t.Run(tc.name, func(t *testing.T) {
975975
// Setup client with mock
976976
client := github.NewClient(tc.mockedClient)
977-
_, handler := getPullRequestReviews(client, translations.NullTranslationHelper)
977+
_, handler := GetPullRequestReviews(client, translations.NullTranslationHelper)
978978

979979
// Create call request
980980
request := createMCPRequest(tc.requestArgs)
@@ -1013,7 +1013,7 @@ func Test_GetPullRequestReviews(t *testing.T) {
10131013
func Test_CreatePullRequestReview(t *testing.T) {
10141014
// Verify tool definition once
10151015
mockClient := github.NewClient(nil)
1016-
tool, _ := createPullRequestReview(mockClient, translations.NullTranslationHelper)
1016+
tool, _ := CreatePullRequestReview(mockClient, translations.NullTranslationHelper)
10171017

10181018
assert.Equal(t, "create_pull_request_review", tool.Name)
10191019
assert.NotEmpty(t, tool.Description)
@@ -1341,7 +1341,7 @@ func Test_CreatePullRequestReview(t *testing.T) {
13411341
t.Run(tc.name, func(t *testing.T) {
13421342
// Setup client with mock
13431343
client := github.NewClient(tc.mockedClient)
1344-
_, handler := createPullRequestReview(client, translations.NullTranslationHelper)
1344+
_, handler := CreatePullRequestReview(client, translations.NullTranslationHelper)
13451345

13461346
// Create call request
13471347
request := createMCPRequest(tc.requestArgs)
@@ -1384,7 +1384,7 @@ func Test_CreatePullRequestReview(t *testing.T) {
13841384
func Test_CreatePullRequest(t *testing.T) {
13851385
// Verify tool definition once
13861386
mockClient := github.NewClient(nil)
1387-
tool, _ := createPullRequest(mockClient, translations.NullTranslationHelper)
1387+
tool, _ := CreatePullRequest(mockClient, translations.NullTranslationHelper)
13881388

13891389
assert.Equal(t, "create_pull_request", tool.Name)
13901390
assert.NotEmpty(t, tool.Description)
@@ -1496,7 +1496,7 @@ func Test_CreatePullRequest(t *testing.T) {
14961496
t.Run(tc.name, func(t *testing.T) {
14971497
// Setup client with mock
14981498
client := github.NewClient(tc.mockedClient)
1499-
_, handler := createPullRequest(client, translations.NullTranslationHelper)
1499+
_, handler := CreatePullRequest(client, translations.NullTranslationHelper)
15001500

15011501
// Create call request
15021502
request := createMCPRequest(tc.requestArgs)

pkg/github/server.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -42,17 +42,17 @@ func NewServer(client *github.Client, version string, readOnly bool, t translati
4242
}
4343

4444
// Add GitHub tools - Pull Requests
45-
s.AddTool(getPullRequest(client, t))
46-
s.AddTool(listPullRequests(client, t))
47-
s.AddTool(getPullRequestFiles(client, t))
48-
s.AddTool(getPullRequestStatus(client, t))
49-
s.AddTool(getPullRequestComments(client, t))
50-
s.AddTool(getPullRequestReviews(client, t))
45+
s.AddTool(GetPullRequest(client, t))
46+
s.AddTool(ListPullRequests(client, t))
47+
s.AddTool(GetPullRequestFiles(client, t))
48+
s.AddTool(GetPullRequestStatus(client, t))
49+
s.AddTool(GetPullRequestComments(client, t))
50+
s.AddTool(GetPullRequestReviews(client, t))
5151
if !readOnly {
52-
s.AddTool(mergePullRequest(client, t))
53-
s.AddTool(updatePullRequestBranch(client, t))
54-
s.AddTool(createPullRequestReview(client, t))
55-
s.AddTool(createPullRequest(client, t))
52+
s.AddTool(MergePullRequest(client, t))
53+
s.AddTool(UpdatePullRequestBranch(client, t))
54+
s.AddTool(CreatePullRequestReview(client, t))
55+
s.AddTool(CreatePullRequest(client, t))
5656
}
5757

5858
// Add GitHub tools - Repositories

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy