Skip to main content
Glama

merge_pull_request

Combine changes from a Pull Request in Gitee repositories by specifying owner, repository, PR number, merge method, and branch deletion options.

Instructions

合并 Gitee 仓库中的 Pull Request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
merge_methodNoMerge methodmerge
ownerYesRepository owner path (enterprise, organization, or personal path)
prune_source_branchNoWhether to delete the source branch after merging
pull_numberYesPull Request number
repoYesRepository path

Implementation Reference

  • The handler function that merges a pull request by making a PUT request to the Gitee API endpoint for merging.
    export async function mergePullRequest(
      owner: string,
      repo: string,
      pullNumber: number,
      options: Omit<MergePullRequestOptions, "owner" | "repo" | "pull_number">
    ) {
      owner = validateOwnerName(owner);
      repo = validateRepositoryName(repo);
    
      const url = `/repos/${owner}/${repo}/pulls/${pullNumber}/merge`;
      const response = await giteeRequest(url, "PUT", options);
    
      return response;
    }
  • Zod schema defining the input parameters for the merge_pull_request tool, including owner, repo, pull_number, merge_method, and prune_source_branch.
    export const MergePullRequestSchema = z.object({
      // 仓库所属空间地址 (企业、组织或个人的地址 path)
      owner: z.string().describe("Repository owner path (enterprise, organization, or personal path)"),
      // 仓库路径 (path)
      repo: z.string().describe("Repository path"),
      // Pull Request 编号
      pull_number: z.number().describe("Pull Request number"),
      // 合并方式
      merge_method: z.enum(["merge", "squash", "rebase"]).default("merge").optional().describe("Merge method"),
      // 合并后是否删除源分支
      prune_source_branch: z.boolean().optional().describe("Whether to delete the source branch after merging"),
    });
  • index.ts:238-250 (registration)
    Registration of the merge_pull_request tool in the MCP server, linking the schema and delegating to the pullOperations.mergePullRequest handler.
    server.registerTool({
      name: "merge_pull_request",
      description: "合并 Gitee 仓库中的 Pull Request",
      schema: pullOperations.MergePullRequestSchema,
      handler: async (params: any) => {
        const { owner, repo, pull_number, ...options } = params;
        // 确保必需参数存在
        if (!owner || !repo || pull_number === undefined) {
          throw new Error("owner, repo 和 pull_number 参数是必需的");
        }
        return await pullOperations.mergePullRequest(owner, repo, pull_number, options);
      },
    });
Behavior2/5

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

No annotations are provided, so the description carries the full burden of behavioral disclosure. While '合并' implies a write/mutation operation, it doesn't mention permissions required, whether the merge is reversible, rate limits, or what happens on failure. This leaves significant gaps for an agent to understand the tool's behavior safely.

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, clear sentence that directly states the tool's purpose without any fluff or redundant information. It's front-loaded and efficiently communicates the core function, making it easy for an agent to parse quickly.

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 merging a pull request (a mutation with potential side effects like branch deletion), no annotations, and no output schema, the description is insufficient. It doesn't cover error conditions, return values, or important behavioral aspects like what 'merge' entails in Gitee's context, leaving the agent with incomplete context for safe invocation.

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?

The schema description coverage is 100%, with all parameters well-documented in the schema itself (e.g., merge_method with enum values, prune_source_branch meaning). The description adds no additional parameter semantics beyond what's already in the schema, so it meets the baseline score of 3 for high schema coverage.

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 clearly states the action ('合并' meaning 'merge') and the resource ('Gitee 仓库中的 Pull Request'), making the purpose immediately understandable. However, it doesn't differentiate this tool from potential alternatives like 'update_pull_request' or other PR-related tools in the sibling list, which would require explicit comparison.

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. With sibling tools like 'update_pull_request' and 'list_pull_requests' available, there's no indication of whether this is the primary method for merging PRs or if there are specific prerequisites (e.g., PR must be in a mergeable state).

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/normal-coder/gitee-mcp-server'

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