Skip to content

chore: export code scanning funcs #162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 8, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pkg/github/code_scanning.go
Original file line number Diff line number Diff line change
@@ -13,7 +13,7 @@ import (
"github.com/mark3labs/mcp-go/server"
)

func getCodeScanningAlert(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
func GetCodeScanningAlert(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("get_code_scanning_alert",
mcp.WithDescription(t("TOOL_GET_CODE_SCANNING_ALERT_DESCRIPTION", "Get details of a specific code scanning alert in a GitHub repository.")),
mcp.WithString("owner",
@@ -66,7 +66,7 @@ func getCodeScanningAlert(client *github.Client, t translations.TranslationHelpe
}
}

func listCodeScanningAlerts(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
func ListCodeScanningAlerts(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("list_code_scanning_alerts",
mcp.WithDescription(t("TOOL_LIST_CODE_SCANNING_ALERTS_DESCRIPTION", "List code scanning alerts in a GitHub repository.")),
mcp.WithString("owner",
8 changes: 4 additions & 4 deletions pkg/github/code_scanning_test.go
Original file line number Diff line number Diff line change
@@ -16,7 +16,7 @@ import (
func Test_GetCodeScanningAlert(t *testing.T) {
// Verify tool definition once
mockClient := github.NewClient(nil)
tool, _ := getCodeScanningAlert(mockClient, translations.NullTranslationHelper)
tool, _ := GetCodeScanningAlert(mockClient, translations.NullTranslationHelper)

assert.Equal(t, "get_code_scanning_alert", tool.Name)
assert.NotEmpty(t, tool.Description)
@@ -82,7 +82,7 @@ func Test_GetCodeScanningAlert(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
// Setup client with mock
client := github.NewClient(tc.mockedClient)
_, handler := getCodeScanningAlert(client, translations.NullTranslationHelper)
_, handler := GetCodeScanningAlert(client, translations.NullTranslationHelper)

// Create call request
request := createMCPRequest(tc.requestArgs)
@@ -118,7 +118,7 @@ func Test_GetCodeScanningAlert(t *testing.T) {
func Test_ListCodeScanningAlerts(t *testing.T) {
// Verify tool definition once
mockClient := github.NewClient(nil)
tool, _ := listCodeScanningAlerts(mockClient, translations.NullTranslationHelper)
tool, _ := ListCodeScanningAlerts(mockClient, translations.NullTranslationHelper)

assert.Equal(t, "list_code_scanning_alerts", tool.Name)
assert.NotEmpty(t, tool.Description)
@@ -201,7 +201,7 @@ func Test_ListCodeScanningAlerts(t *testing.T) {
t.Run(tc.name, func(t *testing.T) {
// Setup client with mock
client := github.NewClient(tc.mockedClient)
_, handler := listCodeScanningAlerts(client, translations.NullTranslationHelper)
_, handler := ListCodeScanningAlerts(client, translations.NullTranslationHelper)

// Create call request
request := createMCPRequest(tc.requestArgs)
4 changes: 2 additions & 2 deletions pkg/github/server.go
Original file line number Diff line number Diff line change
@@ -75,8 +75,8 @@ func NewServer(client *github.Client, version string, readOnly bool, t translati
s.AddTool(getMe(client, t))

// Add GitHub tools - Code Scanning
s.AddTool(getCodeScanningAlert(client, t))
s.AddTool(listCodeScanningAlerts(client, t))
s.AddTool(GetCodeScanningAlert(client, t))
s.AddTool(ListCodeScanningAlerts(client, t))
return s
}