Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

merge-pull-request

Merge a GitHub pull request using specified merge method (merge, squash, or rebase) with customizable commit messages for repository integration.

Instructions

Merge a pull request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
commit_messageNoExtra detail to append to automatic commit message
commit_titleNoTitle for the automatic commit message
merge_methodNoMerge method to use
ownerYesRepository owner (username or organization)
pull_numberYesPull request number
repoYesRepository name

Implementation Reference

  • The handler function that executes the merge-pull-request tool. Parses arguments using schema, calls GitHub API to merge the PR, and returns result.
    export async function mergePullRequest(args: unknown): Promise<any> {
      const { owner, repo, pull_number, commit_title, commit_message, merge_method } = MergePullRequestSchema.parse(args);
      const github = getGitHubApi();
    
      return tryCatchAsync(async () => {
        const { data } = await github.getOctokit().pulls.merge({
          owner,
          repo,
          pull_number,
          commit_title,
          commit_message,
          merge_method,
        });
    
        return {
          merged: data.merged,
          message: data.message,
          sha: data.sha,
        };
      }, 'Failed to merge pull request');
    }
  • src/server.ts:868-902 (registration)
    Tool registration in the MCP server, defining name, description, and input schema.
    {
      name: 'merge-pull-request',
      description: 'Merge a pull request',
      inputSchema: {
        type: 'object',
        properties: {
          owner: {
            type: 'string',
            description: 'Repository owner (username or organization)',
          },
          repo: {
            type: 'string',
            description: 'Repository name',
          },
          pull_number: {
            type: 'number',
            description: 'Pull request number',
          },
          commit_title: {
            type: 'string',
            description: 'Title for the automatic commit message',
          },
          commit_message: {
            type: 'string',
            description: 'Extra detail to append to automatic commit message',
          },
          merge_method: {
            type: 'string',
            enum: ['merge', 'squash', 'rebase'],
            description: 'Merge method to use',
          },
        },
        required: ['owner', 'repo', 'pull_number'],
        additionalProperties: false,
      },
  • Dispatch case in the tool handler switch statement that calls the mergePullRequest function.
    case 'merge-pull-request':
      result = await mergePullRequest(parsedArgs);
      break;
  • Zod schema definition for validating inputs to the merge-pull-request tool, extended from OwnerRepoSchema.
    export const MergePullRequestSchema = OwnerRepoSchema.extend({
      pull_number: z.number().int().positive(),
      commit_title: z.string().optional(),
      commit_message: z.string().optional(),
      merge_method: z.enum(['merge', 'squash', 'rebase']).optional(),
    });
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure. 'Merge a pull request' implies a write operation that modifies repository state, but it doesn't disclose critical traits like required permissions (e.g., write access), whether it's destructive (merging typically is irreversible), rate limits, or what happens on success/failure (e.g., branch deletion). This leaves significant gaps for safe agent invocation.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, efficient sentence with zero waste—it directly states the tool's action without fluff. It's appropriately front-loaded and earns its place by conveying the core purpose, though it could benefit from additional context.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity of a merge operation (a write action with potential side effects), no annotations, and no output schema, the description is incomplete. It lacks information on behavioral traits, usage context, and expected outcomes, making it inadequate for safe and effective agent use without relying heavily on external knowledge.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 6 parameters thoroughly. The description adds no parameter-specific information beyond the tool name implying 'pull request' as a resource, which is redundant with the schema. Baseline 3 is appropriate as the schema does the heavy lifting, but no extra value is added.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description 'Merge a pull request' clearly states the action (merge) and resource (pull request), but it's vague about scope and doesn't differentiate from siblings like 'update-pull-request-branch' which might also involve merging operations. It provides basic purpose but lacks specificity about what merging entails in this context.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like 'update-pull-request-branch' or other pull request management tools. The description doesn't mention prerequisites (e.g., pull request must be in a mergeable state) or exclusions, leaving usage context entirely implicit.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/piyushgIITian/github-enterprice-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server