MCPcopy Index your code
hub / github.com/github/github-mcp-server / MergePullRequest

Function MergePullRequest

pkg/github/pullrequests.go:1452–1558  ·  view source on GitHub ↗

MergePullRequest creates a tool to merge a pull request.

(t translations.TranslationHelperFunc)

Source from the content-addressed store, hash-verified

1450
1451// MergePullRequest creates a tool to merge a pull request.
1452func MergePullRequest(t translations.TranslationHelperFunc) inventory.ServerTool {
1453 schema := &jsonschema.Schema{
1454 Type: "object",
1455 Properties: map[string]*jsonschema.Schema{
1456 "owner": {
1457 Type: "string",
1458 Description: "Repository owner",
1459 },
1460 "repo": {
1461 Type: "string",
1462 Description: "Repository name",
1463 },
1464 "pullNumber": {
1465 Type: "number",
1466 Description: "Pull request number",
1467 },
1468 "commit_title": {
1469 Type: "string",
1470 Description: "Title for merge commit",
1471 },
1472 "commit_message": {
1473 Type: "string",
1474 Description: "Extra detail for merge commit",
1475 },
1476 "merge_method": {
1477 Type: "string",
1478 Description: "Merge method",
1479 Enum: []any{"merge", "squash", "rebase"},
1480 },
1481 },
1482 Required: []string{"owner", "repo", "pullNumber"},
1483 }
1484
1485 return NewTool(
1486 ToolsetMetadataPullRequests,
1487 mcp.Tool{
1488 Name: "merge_pull_request",
1489 Description: t("TOOL_MERGE_PULL_REQUEST_DESCRIPTION", "Merge a pull request in a GitHub repository."),
1490 Icons: octicons.Icons("git-merge"),
1491 Annotations: &mcp.ToolAnnotations{
1492 Title: t("TOOL_MERGE_PULL_REQUEST_USER_TITLE", "Merge pull request"),
1493 ReadOnlyHint: false,
1494 },
1495 InputSchema: schema,
1496 },
1497 []scopes.Scope{scopes.Repo},
1498 func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
1499 owner, err := RequiredParam[string](args, "owner")
1500 if err != nil {
1501 return utils.NewToolResultError(err.Error()), nil, nil
1502 }
1503 repo, err := RequiredParam[string](args, "repo")
1504 if err != nil {
1505 return utils.NewToolResultError(err.Error()), nil, nil
1506 }
1507 pullNumber, err := RequiredInt(args, "pullNumber")
1508 if err != nil {
1509 return utils.NewToolResultError(err.Error()), nil, nil

Callers 2

AllToolsFunction · 0.85
Test_MergePullRequestFunction · 0.85

Calls 9

IconsFunction · 0.92
NewToolResultErrorFunction · 0.92
NewToolResultTextFunction · 0.92
NewToolFunction · 0.85
RequiredIntFunction · 0.85
CloseMethod · 0.80
GetClientMethod · 0.65
ErrorMethod · 0.45

Tested by 1

Test_MergePullRequestFunction · 0.68