Skip to content

Commit f4770fa

Browse files
chore: export issues funcs
1 parent 9a5fe11 commit f4770fa

File tree

3 files changed

+35
-35
lines changed

3 files changed

+35
-35
lines changed

pkg/github/issues.go

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

17-
// getIssue creates a tool to get details of a specific issue in a GitHub repository.
18-
func getIssue(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
17+
// GetIssue creates a tool to get details of a specific issue in a GitHub repository.
18+
func GetIssue(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
1919
return mcp.NewTool("get_issue",
2020
mcp.WithDescription(t("TOOL_GET_ISSUE_DESCRIPTION", "Get details of a specific issue in a GitHub repository")),
2121
mcp.WithString("owner",
@@ -68,8 +68,8 @@ func getIssue(client *github.Client, t translations.TranslationHelperFunc) (tool
6868
}
6969
}
7070

71-
// addIssueComment creates a tool to add a comment to an issue.
72-
func addIssueComment(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
71+
// AddIssueComment creates a tool to add a comment to an issue.
72+
func AddIssueComment(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
7373
return mcp.NewTool("add_issue_comment",
7474
mcp.WithDescription(t("TOOL_ADD_ISSUE_COMMENT_DESCRIPTION", "Add a comment to an existing issue")),
7575
mcp.WithString("owner",
@@ -134,8 +134,8 @@ func addIssueComment(client *github.Client, t translations.TranslationHelperFunc
134134
}
135135
}
136136

137-
// searchIssues creates a tool to search for issues and pull requests.
138-
func searchIssues(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
137+
// SearchIssues creates a tool to search for issues and pull requests.
138+
func SearchIssues(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
139139
return mcp.NewTool("search_issues",
140140
mcp.WithDescription(t("TOOL_SEARCH_ISSUES_DESCRIPTION", "Search for issues and pull requests across GitHub repositories")),
141141
mcp.WithString("q",
@@ -214,8 +214,8 @@ func searchIssues(client *github.Client, t translations.TranslationHelperFunc) (
214214
}
215215
}
216216

217-
// createIssue creates a tool to create a new issue in a GitHub repository.
218-
func createIssue(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
217+
// CreateIssue creates a tool to create a new issue in a GitHub repository.
218+
func CreateIssue(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
219219
return mcp.NewTool("create_issue",
220220
mcp.WithDescription(t("TOOL_CREATE_ISSUE_DESCRIPTION", "Create a new issue in a GitHub repository")),
221221
mcp.WithString("owner",
@@ -328,8 +328,8 @@ func createIssue(client *github.Client, t translations.TranslationHelperFunc) (t
328328
}
329329
}
330330

331-
// listIssues creates a tool to list and filter repository issues
332-
func listIssues(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
331+
// ListIssues creates a tool to list and filter repository issues
332+
func ListIssues(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
333333
return mcp.NewTool("list_issues",
334334
mcp.WithDescription(t("TOOL_LIST_ISSUES_DESCRIPTION", "List issues in a GitHub repository with filtering options")),
335335
mcp.WithString("owner",
@@ -442,8 +442,8 @@ func listIssues(client *github.Client, t translations.TranslationHelperFunc) (to
442442
}
443443
}
444444

445-
// updateIssue creates a tool to update an existing issue in a GitHub repository.
446-
func updateIssue(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
445+
// UpdateIssue creates a tool to update an existing issue in a GitHub repository.
446+
func UpdateIssue(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
447447
return mcp.NewTool("update_issue",
448448
mcp.WithDescription(t("TOOL_UPDATE_ISSUE_DESCRIPTION", "Update an existing issue in a GitHub repository")),
449449
mcp.WithString("owner",
@@ -580,8 +580,8 @@ func updateIssue(client *github.Client, t translations.TranslationHelperFunc) (t
580580
}
581581
}
582582

583-
// getIssueComments creates a tool to get comments for a GitHub issue.
584-
func getIssueComments(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
583+
// GetIssueComments creates a tool to get comments for a GitHub issue.
584+
func GetIssueComments(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
585585
return mcp.NewTool("get_issue_comments",
586586
mcp.WithDescription(t("TOOL_GET_ISSUE_COMMENTS_DESCRIPTION", "Get comments for a GitHub issue")),
587587
mcp.WithString("owner",

pkg/github/issues_test.go

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
func Test_GetIssue(t *testing.T) {
1919
// Verify tool definition once
2020
mockClient := github.NewClient(nil)
21-
tool, _ := getIssue(mockClient, translations.NullTranslationHelper)
21+
tool, _ := GetIssue(mockClient, translations.NullTranslationHelper)
2222

2323
assert.Equal(t, "get_issue", tool.Name)
2424
assert.NotEmpty(t, tool.Description)
@@ -82,7 +82,7 @@ func Test_GetIssue(t *testing.T) {
8282
t.Run(tc.name, func(t *testing.T) {
8383
// Setup client with mock
8484
client := github.NewClient(tc.mockedClient)
85-
_, handler := getIssue(client, translations.NullTranslationHelper)
85+
_, handler := GetIssue(client, translations.NullTranslationHelper)
8686

8787
// Create call request
8888
request := createMCPRequest(tc.requestArgs)
@@ -114,7 +114,7 @@ func Test_GetIssue(t *testing.T) {
114114
func Test_AddIssueComment(t *testing.T) {
115115
// Verify tool definition once
116116
mockClient := github.NewClient(nil)
117-
tool, _ := addIssueComment(mockClient, translations.NullTranslationHelper)
117+
tool, _ := AddIssueComment(mockClient, translations.NullTranslationHelper)
118118

119119
assert.Equal(t, "add_issue_comment", tool.Name)
120120
assert.NotEmpty(t, tool.Description)
@@ -185,7 +185,7 @@ func Test_AddIssueComment(t *testing.T) {
185185
t.Run(tc.name, func(t *testing.T) {
186186
// Setup client with mock
187187
client := github.NewClient(tc.mockedClient)
188-
_, handler := addIssueComment(client, translations.NullTranslationHelper)
188+
_, handler := AddIssueComment(client, translations.NullTranslationHelper)
189189

190190
// Create call request
191191
request := mcp.CallToolRequest{
@@ -237,7 +237,7 @@ func Test_AddIssueComment(t *testing.T) {
237237
func Test_SearchIssues(t *testing.T) {
238238
// Verify tool definition once
239239
mockClient := github.NewClient(nil)
240-
tool, _ := searchIssues(mockClient, translations.NullTranslationHelper)
240+
tool, _ := SearchIssues(mockClient, translations.NullTranslationHelper)
241241

242242
assert.Equal(t, "search_issues", tool.Name)
243243
assert.NotEmpty(t, tool.Description)
@@ -352,7 +352,7 @@ func Test_SearchIssues(t *testing.T) {
352352
t.Run(tc.name, func(t *testing.T) {
353353
// Setup client with mock
354354
client := github.NewClient(tc.mockedClient)
355-
_, handler := searchIssues(client, translations.NullTranslationHelper)
355+
_, handler := SearchIssues(client, translations.NullTranslationHelper)
356356

357357
// Create call request
358358
request := createMCPRequest(tc.requestArgs)
@@ -393,7 +393,7 @@ func Test_SearchIssues(t *testing.T) {
393393
func Test_CreateIssue(t *testing.T) {
394394
// Verify tool definition once
395395
mockClient := github.NewClient(nil)
396-
tool, _ := createIssue(mockClient, translations.NullTranslationHelper)
396+
tool, _ := CreateIssue(mockClient, translations.NullTranslationHelper)
397397

398398
assert.Equal(t, "create_issue", tool.Name)
399399
assert.NotEmpty(t, tool.Description)
@@ -505,7 +505,7 @@ func Test_CreateIssue(t *testing.T) {
505505
t.Run(tc.name, func(t *testing.T) {
506506
// Setup client with mock
507507
client := github.NewClient(tc.mockedClient)
508-
_, handler := createIssue(client, translations.NullTranslationHelper)
508+
_, handler := CreateIssue(client, translations.NullTranslationHelper)
509509

510510
// Create call request
511511
request := createMCPRequest(tc.requestArgs)
@@ -566,7 +566,7 @@ func Test_CreateIssue(t *testing.T) {
566566
func Test_ListIssues(t *testing.T) {
567567
// Verify tool definition
568568
mockClient := github.NewClient(nil)
569-
tool, _ := listIssues(mockClient, translations.NullTranslationHelper)
569+
tool, _ := ListIssues(mockClient, translations.NullTranslationHelper)
570570

571571
assert.Equal(t, "list_issues", tool.Name)
572572
assert.NotEmpty(t, tool.Description)
@@ -697,7 +697,7 @@ func Test_ListIssues(t *testing.T) {
697697
t.Run(tc.name, func(t *testing.T) {
698698
// Setup client with mock
699699
client := github.NewClient(tc.mockedClient)
700-
_, handler := listIssues(client, translations.NullTranslationHelper)
700+
_, handler := ListIssues(client, translations.NullTranslationHelper)
701701

702702
// Create call request
703703
request := createMCPRequest(tc.requestArgs)
@@ -742,7 +742,7 @@ func Test_ListIssues(t *testing.T) {
742742
func Test_UpdateIssue(t *testing.T) {
743743
// Verify tool definition
744744
mockClient := github.NewClient(nil)
745-
tool, _ := updateIssue(mockClient, translations.NullTranslationHelper)
745+
tool, _ := UpdateIssue(mockClient, translations.NullTranslationHelper)
746746

747747
assert.Equal(t, "update_issue", tool.Name)
748748
assert.NotEmpty(t, tool.Description)
@@ -881,7 +881,7 @@ func Test_UpdateIssue(t *testing.T) {
881881
t.Run(tc.name, func(t *testing.T) {
882882
// Setup client with mock
883883
client := github.NewClient(tc.mockedClient)
884-
_, handler := updateIssue(client, translations.NullTranslationHelper)
884+
_, handler := UpdateIssue(client, translations.NullTranslationHelper)
885885

886886
// Create call request
887887
request := createMCPRequest(tc.requestArgs)
@@ -999,7 +999,7 @@ func Test_ParseISOTimestamp(t *testing.T) {
999999
func Test_GetIssueComments(t *testing.T) {
10001000
// Verify tool definition once
10011001
mockClient := github.NewClient(nil)
1002-
tool, _ := getIssueComments(mockClient, translations.NullTranslationHelper)
1002+
tool, _ := GetIssueComments(mockClient, translations.NullTranslationHelper)
10031003

10041004
assert.Equal(t, "get_issue_comments", tool.Name)
10051005
assert.NotEmpty(t, tool.Description)
@@ -1099,7 +1099,7 @@ func Test_GetIssueComments(t *testing.T) {
10991099
t.Run(tc.name, func(t *testing.T) {
11001100
// Setup client with mock
11011101
client := github.NewClient(tc.mockedClient)
1102-
_, handler := getIssueComments(client, translations.NullTranslationHelper)
1102+
_, handler := GetIssueComments(client, translations.NullTranslationHelper)
11031103

11041104
// Create call request
11051105
request := createMCPRequest(tc.requestArgs)

pkg/github/server.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ func NewServer(client *github.Client, version string, readOnly bool, t translati
3131
s.AddResourceTemplate(getRepositoryResourcePrContent(client, t))
3232

3333
// Add GitHub tools - Issues
34-
s.AddTool(getIssue(client, t))
35-
s.AddTool(searchIssues(client, t))
36-
s.AddTool(listIssues(client, t))
37-
s.AddTool(getIssueComments(client, t))
34+
s.AddTool(GetIssue(client, t))
35+
s.AddTool(SearchIssues(client, t))
36+
s.AddTool(ListIssues(client, t))
37+
s.AddTool(GetIssueComments(client, t))
3838
if !readOnly {
39-
s.AddTool(createIssue(client, t))
40-
s.AddTool(addIssueComment(client, t))
41-
s.AddTool(updateIssue(client, t))
39+
s.AddTool(CreateIssue(client, t))
40+
s.AddTool(AddIssueComment(client, t))
41+
s.AddTool(UpdateIssue(client, t))
4242
}
4343

4444
// Add GitHub tools - Pull Requests

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