Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

chore: export pr funcs#164

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
SamMorrowDrums merged 1 commit intomainfromexport-prs
Apr 8, 2025
Merged
Show file tree
Hide file tree
Changes fromall 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
40 changes: 20 additions & 20 deletionspkg/github/pullrequests.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,8 +13,8 @@ import (
"github.com/mark3labs/mcp-go/server"
)

//getPullRequest creates a tool to get details of a specific pull request.
funcgetPullRequest(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
//GetPullRequest creates a tool to get details of a specific pull request.
funcGetPullRequest(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("get_pull_request",
mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_DESCRIPTION", "Get details of a specific pull request")),
mcp.WithString("owner",
Expand DownExpand Up@@ -67,8 +67,8 @@ func getPullRequest(client *github.Client, t translations.TranslationHelperFunc)
}
}

//listPullRequests creates a tool to list and filter repository pull requests.
funclistPullRequests(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
//ListPullRequests creates a tool to list and filter repository pull requests.
funcListPullRequests(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("list_pull_requests",
mcp.WithDescription(t("TOOL_LIST_PULL_REQUESTS_DESCRIPTION", "List and filter repository pull requests")),
mcp.WithString("owner",
Expand DownExpand Up@@ -165,8 +165,8 @@ func listPullRequests(client *github.Client, t translations.TranslationHelperFun
}
}

//mergePullRequest creates a tool to merge a pull request.
funcmergePullRequest(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
//MergePullRequest creates a tool to merge a pull request.
funcMergePullRequest(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("merge_pull_request",
mcp.WithDescription(t("TOOL_MERGE_PULL_REQUEST_DESCRIPTION", "Merge a pull request")),
mcp.WithString("owner",
Expand DownExpand Up@@ -245,8 +245,8 @@ func mergePullRequest(client *github.Client, t translations.TranslationHelperFun
}
}

//getPullRequestFiles creates a tool to get the list of files changed in a pull request.
funcgetPullRequestFiles(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
//GetPullRequestFiles creates a tool to get the list of files changed in a pull request.
funcGetPullRequestFiles(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("get_pull_request_files",
mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_FILES_DESCRIPTION", "Get the list of files changed in a pull request")),
mcp.WithString("owner",
Expand DownExpand Up@@ -300,8 +300,8 @@ func getPullRequestFiles(client *github.Client, t translations.TranslationHelper
}
}

//getPullRequestStatus creates a tool to get the combined status of all status checks for a pull request.
funcgetPullRequestStatus(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
//GetPullRequestStatus creates a tool to get the combined status of all status checks for a pull request.
funcGetPullRequestStatus(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("get_pull_request_status",
mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_STATUS_DESCRIPTION", "Get the combined status of all status checks for a pull request")),
mcp.WithString("owner",
Expand DownExpand Up@@ -369,8 +369,8 @@ func getPullRequestStatus(client *github.Client, t translations.TranslationHelpe
}
}

//updatePullRequestBranch creates a tool to update a pull request branch with the latest changes from the base branch.
funcupdatePullRequestBranch(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
//UpdatePullRequestBranch creates a tool to update a pull request branch with the latest changes from the base branch.
funcUpdatePullRequestBranch(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("update_pull_request_branch",
mcp.WithDescription(t("TOOL_UPDATE_PULL_REQUEST_BRANCH_DESCRIPTION", "Update a pull request branch with the latest changes from the base branch")),
mcp.WithString("owner",
Expand DownExpand Up@@ -439,8 +439,8 @@ func updatePullRequestBranch(client *github.Client, t translations.TranslationHe
}
}

//getPullRequestComments creates a tool to get the review comments on a pull request.
funcgetPullRequestComments(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
//GetPullRequestComments creates a tool to get the review comments on a pull request.
funcGetPullRequestComments(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("get_pull_request_comments",
mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_COMMENTS_DESCRIPTION", "Get the review comments on a pull request")),
mcp.WithString("owner",
Expand DownExpand Up@@ -499,8 +499,8 @@ func getPullRequestComments(client *github.Client, t translations.TranslationHel
}
}

//getPullRequestReviews creates a tool to get the reviews on a pull request.
funcgetPullRequestReviews(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
//GetPullRequestReviews creates a tool to get the reviews on a pull request.
funcGetPullRequestReviews(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("get_pull_request_reviews",
mcp.WithDescription(t("TOOL_GET_PULL_REQUEST_REVIEWS_DESCRIPTION", "Get the reviews on a pull request")),
mcp.WithString("owner",
Expand DownExpand Up@@ -553,8 +553,8 @@ func getPullRequestReviews(client *github.Client, t translations.TranslationHelp
}
}

//createPullRequestReview creates a tool to submit a review on a pull request.
funccreatePullRequestReview(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
//CreatePullRequestReview creates a tool to submit a review on a pull request.
funcCreatePullRequestReview(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("create_pull_request_review",
mcp.WithDescription(t("TOOL_CREATE_PULL_REQUEST_REVIEW_DESCRIPTION", "Create a review on a pull request")),
mcp.WithString("owner",
Expand DownExpand Up@@ -745,8 +745,8 @@ func createPullRequestReview(client *github.Client, t translations.TranslationHe
}
}

//createPullRequest creates a tool to create a new pull request.
funccreatePullRequest(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
//CreatePullRequest creates a tool to create a new pull request.
funcCreatePullRequest(client *github.Client, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
return mcp.NewTool("create_pull_request",
mcp.WithDescription(t("TOOL_CREATE_PULL_REQUEST_DESCRIPTION", "Create a new pull request in a GitHub repository")),
mcp.WithString("owner",
Expand Down
40 changes: 20 additions & 20 deletionspkg/github/pullrequests_test.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -17,7 +17,7 @@ import (
func Test_GetPullRequest(t *testing.T) {
// Verify tool definition once
mockClient := github.NewClient(nil)
tool, _ :=getPullRequest(mockClient, translations.NullTranslationHelper)
tool, _ :=GetPullRequest(mockClient, translations.NullTranslationHelper)

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

// Create call request
request := createMCPRequest(tc.requestArgs)
Expand DownExpand Up@@ -129,7 +129,7 @@ func Test_GetPullRequest(t *testing.T) {
func Test_ListPullRequests(t *testing.T) {
// Verify tool definition once
mockClient := github.NewClient(nil)
tool, _ :=listPullRequests(mockClient, translations.NullTranslationHelper)
tool, _ :=ListPullRequests(mockClient, translations.NullTranslationHelper)

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

// Create call request
request := createMCPRequest(tc.requestArgs)
Expand DownExpand Up@@ -259,7 +259,7 @@ func Test_ListPullRequests(t *testing.T) {
func Test_MergePullRequest(t *testing.T) {
// Verify tool definition once
mockClient := github.NewClient(nil)
tool, _ :=mergePullRequest(mockClient, translations.NullTranslationHelper)
tool, _ :=MergePullRequest(mockClient, translations.NullTranslationHelper)

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

// Create call request
request := createMCPRequest(tc.requestArgs)
Expand DownExpand Up@@ -370,7 +370,7 @@ func Test_MergePullRequest(t *testing.T) {
func Test_GetPullRequestFiles(t *testing.T) {
// Verify tool definition once
mockClient := github.NewClient(nil)
tool, _ :=getPullRequestFiles(mockClient, translations.NullTranslationHelper)
tool, _ :=GetPullRequestFiles(mockClient, translations.NullTranslationHelper)

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

// Create call request
request := createMCPRequest(tc.requestArgs)
Expand DownExpand Up@@ -486,7 +486,7 @@ func Test_GetPullRequestFiles(t *testing.T) {
func Test_GetPullRequestStatus(t *testing.T) {
// Verify tool definition once
mockClient := github.NewClient(nil)
tool, _ :=getPullRequestStatus(mockClient, translations.NullTranslationHelper)
tool, _ :=GetPullRequestStatus(mockClient, translations.NullTranslationHelper)

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

// Create call request
request := createMCPRequest(tc.requestArgs)
Expand DownExpand Up@@ -647,7 +647,7 @@ func Test_GetPullRequestStatus(t *testing.T) {
func Test_UpdatePullRequestBranch(t *testing.T) {
// Verify tool definition once
mockClient := github.NewClient(nil)
tool, _ :=updatePullRequestBranch(mockClient, translations.NullTranslationHelper)
tool, _ :=UpdatePullRequestBranch(mockClient, translations.NullTranslationHelper)

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

// Create call request
request := createMCPRequest(tc.requestArgs)
Expand DownExpand Up@@ -763,7 +763,7 @@ func Test_UpdatePullRequestBranch(t *testing.T) {
func Test_GetPullRequestComments(t *testing.T) {
// Verify tool definition once
mockClient := github.NewClient(nil)
tool, _ :=getPullRequestComments(mockClient, translations.NullTranslationHelper)
tool, _ :=GetPullRequestComments(mockClient, translations.NullTranslationHelper)

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

// Create call request
request := createMCPRequest(tc.requestArgs)
Expand DownExpand Up@@ -890,7 +890,7 @@ func Test_GetPullRequestComments(t *testing.T) {
func Test_GetPullRequestReviews(t *testing.T) {
// Verify tool definition once
mockClient := github.NewClient(nil)
tool, _ :=getPullRequestReviews(mockClient, translations.NullTranslationHelper)
tool, _ :=GetPullRequestReviews(mockClient, translations.NullTranslationHelper)

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

// Create call request
request := createMCPRequest(tc.requestArgs)
Expand DownExpand Up@@ -1013,7 +1013,7 @@ func Test_GetPullRequestReviews(t *testing.T) {
func Test_CreatePullRequestReview(t *testing.T) {
// Verify tool definition once
mockClient := github.NewClient(nil)
tool, _ :=createPullRequestReview(mockClient, translations.NullTranslationHelper)
tool, _ :=CreatePullRequestReview(mockClient, translations.NullTranslationHelper)

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

// Create call request
request := createMCPRequest(tc.requestArgs)
Expand DownExpand Up@@ -1384,7 +1384,7 @@ func Test_CreatePullRequestReview(t *testing.T) {
func Test_CreatePullRequest(t *testing.T) {
// Verify tool definition once
mockClient := github.NewClient(nil)
tool, _ :=createPullRequest(mockClient, translations.NullTranslationHelper)
tool, _ :=CreatePullRequest(mockClient, translations.NullTranslationHelper)

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

// Create call request
request := createMCPRequest(tc.requestArgs)
Expand Down
20 changes: 10 additions & 10 deletionspkg/github/server.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -42,17 +42,17 @@ func NewServer(client *github.Client, version string, readOnly bool, t translati
}

// Add GitHub tools - Pull Requests
s.AddTool(getPullRequest(client, t))
s.AddTool(listPullRequests(client, t))
s.AddTool(getPullRequestFiles(client, t))
s.AddTool(getPullRequestStatus(client, t))
s.AddTool(getPullRequestComments(client, t))
s.AddTool(getPullRequestReviews(client, t))
s.AddTool(GetPullRequest(client, t))
s.AddTool(ListPullRequests(client, t))
s.AddTool(GetPullRequestFiles(client, t))
s.AddTool(GetPullRequestStatus(client, t))
s.AddTool(GetPullRequestComments(client, t))
s.AddTool(GetPullRequestReviews(client, t))
if !readOnly {
s.AddTool(mergePullRequest(client, t))
s.AddTool(updatePullRequestBranch(client, t))
s.AddTool(createPullRequestReview(client, t))
s.AddTool(createPullRequest(client, t))
s.AddTool(MergePullRequest(client, t))
s.AddTool(UpdatePullRequestBranch(client, t))
s.AddTool(CreatePullRequestReview(client, t))
s.AddTool(CreatePullRequest(client, t))
}

// Add GitHub tools - Repositories
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp