Skip to content

Commit 3dae8ab

Browse files
chore: export search funcs
1 parent c1bdd6a commit 3dae8ab

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

pkg/github/search.go

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

15-
// searchRepositories creates a tool to search for GitHub repositories.
16-
func searchRepositories(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
15+
// SearchRepositories creates a tool to search for GitHub repositories.
16+
func SearchRepositories(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
1717
return mcp.NewTool("search_repositories",
1818
mcp.WithDescription(t("TOOL_SEARCH_REPOSITORIES_DESCRIPTION", "Search for GitHub repositories")),
1919
mcp.WithString("query",
@@ -62,8 +62,8 @@ func searchRepositories(client *github.Client, t translations.TranslationHelperF
6262
}
6363
}
6464

65-
// searchCode creates a tool to search for code across GitHub repositories.
66-
func searchCode(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
65+
// SearchCode creates a tool to search for code across GitHub repositories.
66+
func SearchCode(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
6767
return mcp.NewTool("search_code",
6868
mcp.WithDescription(t("TOOL_SEARCH_CODE_DESCRIPTION", "Search for code across GitHub repositories")),
6969
mcp.WithString("q",
@@ -129,8 +129,8 @@ func searchCode(client *github.Client, t translations.TranslationHelperFunc) (to
129129
}
130130
}
131131

132-
// searchUsers creates a tool to search for GitHub users.
133-
func searchUsers(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
132+
// SearchUsers creates a tool to search for GitHub users.
133+
func SearchUsers(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
134134
return mcp.NewTool("search_users",
135135
mcp.WithDescription(t("TOOL_SEARCH_USERS_DESCRIPTION", "Search for GitHub users")),
136136
mcp.WithString("q",

pkg/github/search_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
func Test_SearchRepositories(t *testing.T) {
1717
// Verify tool definition once
1818
mockClient := github.NewClient(nil)
19-
tool, _ := searchRepositories(mockClient, translations.NullTranslationHelper)
19+
tool, _ := SearchRepositories(mockClient, translations.NullTranslationHelper)
2020

2121
assert.Equal(t, "search_repositories", tool.Name)
2222
assert.NotEmpty(t, tool.Description)
@@ -122,7 +122,7 @@ func Test_SearchRepositories(t *testing.T) {
122122
t.Run(tc.name, func(t *testing.T) {
123123
// Setup client with mock
124124
client := github.NewClient(tc.mockedClient)
125-
_, handler := searchRepositories(client, translations.NullTranslationHelper)
125+
_, handler := SearchRepositories(client, translations.NullTranslationHelper)
126126

127127
// Create call request
128128
request := createMCPRequest(tc.requestArgs)
@@ -163,7 +163,7 @@ func Test_SearchRepositories(t *testing.T) {
163163
func Test_SearchCode(t *testing.T) {
164164
// Verify tool definition once
165165
mockClient := github.NewClient(nil)
166-
tool, _ := searchCode(mockClient, translations.NullTranslationHelper)
166+
tool, _ := SearchCode(mockClient, translations.NullTranslationHelper)
167167

168168
assert.Equal(t, "search_code", tool.Name)
169169
assert.NotEmpty(t, tool.Description)
@@ -273,7 +273,7 @@ func Test_SearchCode(t *testing.T) {
273273
t.Run(tc.name, func(t *testing.T) {
274274
// Setup client with mock
275275
client := github.NewClient(tc.mockedClient)
276-
_, handler := searchCode(client, translations.NullTranslationHelper)
276+
_, handler := SearchCode(client, translations.NullTranslationHelper)
277277

278278
// Create call request
279279
request := createMCPRequest(tc.requestArgs)
@@ -314,7 +314,7 @@ func Test_SearchCode(t *testing.T) {
314314
func Test_SearchUsers(t *testing.T) {
315315
// Verify tool definition once
316316
mockClient := github.NewClient(nil)
317-
tool, _ := searchUsers(mockClient, translations.NullTranslationHelper)
317+
tool, _ := SearchUsers(mockClient, translations.NullTranslationHelper)
318318

319319
assert.Equal(t, "search_users", tool.Name)
320320
assert.NotEmpty(t, tool.Description)
@@ -428,7 +428,7 @@ func Test_SearchUsers(t *testing.T) {
428428
t.Run(tc.name, func(t *testing.T) {
429429
// Setup client with mock
430430
client := github.NewClient(tc.mockedClient)
431-
_, handler := searchUsers(client, translations.NullTranslationHelper)
431+
_, handler := SearchUsers(client, translations.NullTranslationHelper)
432432

433433
// Create call request
434434
request := createMCPRequest(tc.requestArgs)

pkg/github/server.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func NewServer(client *github.Client, version string, readOnly bool, t translati
5656
}
5757

5858
// Add GitHub tools - Repositories
59-
s.AddTool(searchRepositories(client, t))
59+
s.AddTool(SearchRepositories(client, t))
6060
s.AddTool(GetFileContents(client, t))
6161
s.AddTool(ListCommits(client, t))
6262
if !readOnly {
@@ -68,8 +68,8 @@ func NewServer(client *github.Client, version string, readOnly bool, t translati
6868
}
6969

7070
// Add GitHub tools - Search
71-
s.AddTool(searchCode(client, t))
72-
s.AddTool(searchUsers(client, t))
71+
s.AddTool(SearchCode(client, t))
72+
s.AddTool(SearchUsers(client, t))
7373

7474
// Add GitHub tools - Users
7575
s.AddTool(getMe(client, t))

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