diff --git a/pkg/github/search.go b/pkg/github/search.go index 117e8298..46fed599 100644 --- a/pkg/github/search.go +++ b/pkg/github/search.go @@ -12,8 +12,8 @@ import ( "github.com/mark3labs/mcp-go/server" ) -// searchRepositories creates a tool to search for GitHub repositories. -func searchRepositories(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { +// SearchRepositories creates a tool to search for GitHub repositories. +func SearchRepositories(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { return mcp.NewTool("search_repositories", mcp.WithDescription(t("TOOL_SEARCH_REPOSITORIES_DESCRIPTION", "Search for GitHub repositories")), mcp.WithString("query", @@ -62,8 +62,8 @@ func searchRepositories(client *github.Client, t translations.TranslationHelperF } } -// searchCode creates a tool to search for code across GitHub repositories. -func searchCode(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { +// SearchCode creates a tool to search for code across GitHub repositories. +func SearchCode(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { return mcp.NewTool("search_code", mcp.WithDescription(t("TOOL_SEARCH_CODE_DESCRIPTION", "Search for code across GitHub repositories")), mcp.WithString("q", @@ -129,8 +129,8 @@ func searchCode(client *github.Client, t translations.TranslationHelperFunc) (to } } -// searchUsers creates a tool to search for GitHub users. -func searchUsers(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { +// SearchUsers creates a tool to search for GitHub users. +func SearchUsers(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) { return mcp.NewTool("search_users", mcp.WithDescription(t("TOOL_SEARCH_USERS_DESCRIPTION", "Search for GitHub users")), mcp.WithString("q", diff --git a/pkg/github/search_test.go b/pkg/github/search_test.go index bf1bff45..b000a0bf 100644 --- a/pkg/github/search_test.go +++ b/pkg/github/search_test.go @@ -16,7 +16,7 @@ import ( func Test_SearchRepositories(t *testing.T) { // Verify tool definition once mockClient := github.NewClient(nil) - tool, _ := searchRepositories(mockClient, translations.NullTranslationHelper) + tool, _ := SearchRepositories(mockClient, translations.NullTranslationHelper) assert.Equal(t, "search_repositories", tool.Name) assert.NotEmpty(t, tool.Description) @@ -122,7 +122,7 @@ func Test_SearchRepositories(t *testing.T) { t.Run(tc.name, func(t *testing.T) { // Setup client with mock client := github.NewClient(tc.mockedClient) - _, handler := searchRepositories(client, translations.NullTranslationHelper) + _, handler := SearchRepositories(client, translations.NullTranslationHelper) // Create call request request := createMCPRequest(tc.requestArgs) @@ -163,7 +163,7 @@ func Test_SearchRepositories(t *testing.T) { func Test_SearchCode(t *testing.T) { // Verify tool definition once mockClient := github.NewClient(nil) - tool, _ := searchCode(mockClient, translations.NullTranslationHelper) + tool, _ := SearchCode(mockClient, translations.NullTranslationHelper) assert.Equal(t, "search_code", tool.Name) assert.NotEmpty(t, tool.Description) @@ -273,7 +273,7 @@ func Test_SearchCode(t *testing.T) { t.Run(tc.name, func(t *testing.T) { // Setup client with mock client := github.NewClient(tc.mockedClient) - _, handler := searchCode(client, translations.NullTranslationHelper) + _, handler := SearchCode(client, translations.NullTranslationHelper) // Create call request request := createMCPRequest(tc.requestArgs) @@ -314,7 +314,7 @@ func Test_SearchCode(t *testing.T) { func Test_SearchUsers(t *testing.T) { // Verify tool definition once mockClient := github.NewClient(nil) - tool, _ := searchUsers(mockClient, translations.NullTranslationHelper) + tool, _ := SearchUsers(mockClient, translations.NullTranslationHelper) assert.Equal(t, "search_users", tool.Name) assert.NotEmpty(t, tool.Description) @@ -428,7 +428,7 @@ func Test_SearchUsers(t *testing.T) { t.Run(tc.name, func(t *testing.T) { // Setup client with mock client := github.NewClient(tc.mockedClient) - _, handler := searchUsers(client, translations.NullTranslationHelper) + _, handler := SearchUsers(client, translations.NullTranslationHelper) // Create call request request := createMCPRequest(tc.requestArgs) diff --git a/pkg/github/server.go b/pkg/github/server.go index 352d9697..d8a9b230 100644 --- a/pkg/github/server.go +++ b/pkg/github/server.go @@ -56,7 +56,7 @@ func NewServer(client *github.Client, version string, readOnly bool, t translati } // Add GitHub tools - Repositories - s.AddTool(searchRepositories(client, t)) + s.AddTool(SearchRepositories(client, t)) s.AddTool(GetFileContents(client, t)) s.AddTool(ListCommits(client, t)) if !readOnly { @@ -68,8 +68,8 @@ func NewServer(client *github.Client, version string, readOnly bool, t translati } // Add GitHub tools - Search - s.AddTool(searchCode(client, t)) - s.AddTool(searchUsers(client, t)) + s.AddTool(SearchCode(client, t)) + s.AddTool(SearchUsers(client, t)) // Add GitHub tools - Users s.AddTool(getMe(client, t))