Skip to main content
Glama

merge_pull_request

Merge a pull request on GitHub by specifying the repository owner, repo name, pull request number, commit details, and merge method.

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

  • Core handler function that executes the GitHub API PUT request to merge the specified pull request.
    export async function mergePullRequest(
      owner: string,
      repo: string,
      pullNumber: number,
      options: Omit<z.infer<typeof MergePullRequestSchema>, 'owner' | 'repo' | 'pull_number'>
    ): Promise<any> {
      return githubRequest(
        `https://api.github.com/repos/${owner}/${repo}/pulls/${pullNumber}/merge`,
        {
          method: 'PUT',
          body: options,
        }
      );
    }
  • Zod input schema defining parameters for the merge_pull_request tool.
    export const MergePullRequestSchema = z.object({
      owner: z.string().describe("Repository owner (username or organization)"),
      repo: z.string().describe("Repository name"),
      pull_number: z.number().describe("Pull request number"),
      commit_title: z.string().optional().describe("Title for the automatic commit message"),
      commit_message: z.string().optional().describe("Extra detail to append to automatic commit message"),
      merge_method: z.enum(['merge', 'squash', 'rebase']).optional().describe("Merge method to use")
    });
  • index.ts:170-174 (registration)
    Registration of the merge_pull_request tool in the MCP server's list of tools.
    {
      name: "merge_pull_request",
      description: "Merge a pull request",
      inputSchema: zodToJsonSchema(pulls.MergePullRequestSchema)
    },
  • Dispatch handler in the main tool request switch statement that parses arguments and invokes the mergePullRequest function.
    case "merge_pull_request": {
      const args = pulls.MergePullRequestSchema.parse(request.params.arguments);
      const { owner, repo, pull_number, ...options } = args;
      const result = await pulls.mergePullRequest(owner, repo, pull_number, options);
      return {
        content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
      };
    }
Behavior2/5

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

With no annotations provided, the description carries full burden for behavioral disclosure but only states the action ('merge') without any context. It doesn't mention that this is a destructive/write operation, potential side effects (e.g., closes the pull request, creates a merge commit), authentication requirements, rate limits, or what happens on failure. For a mutation tool with zero annotation coverage, this is a significant gap in behavioral transparency.

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 extremely concise at just three words, with zero wasted language. It's front-loaded with the core action and resource, making it immediately understandable. Every word earns its place, though this conciseness comes at the cost of completeness in other dimensions.

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 this is a mutation tool with no annotations and no output schema, the description is incomplete. It doesn't explain what happens after merging (e.g., does it return success status, the merge commit SHA?), error conditions, or behavioral constraints. The 100% schema coverage helps with parameters, but overall context for safe and effective use is lacking.

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 additional parameter semantics beyond what's in the schema (e.g., it doesn't explain the relationship between parameters or provide usage examples). This meets the baseline of 3 when the schema does the heavy lifting, but the description doesn't compensate with any extra insights.

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

Purpose4/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 verb ('merge') and resource ('pull request'), making the purpose immediately understandable. However, it doesn't differentiate this tool from sibling tools like 'update_pull_request_branch' or 'create_pull_request', which would require more specific language about what merging entails versus other pull request operations.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., pull request must be in a mergeable state), exclusions (e.g., cannot merge if there are conflicts), or when to choose other tools like 'update_pull_request_branch' for different operations. This leaves the agent without context for appropriate tool selection.

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

Related 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/tuanle96/mcp-github'

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