Skip to main content
Glama

create_pull_request

Create Pull Requests in Gitee repositories by specifying source and target branches, title, content, reviewers, labels, and related issues.

Instructions

在 Gitee 仓库中创建 Pull Request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
assigneesNoReviewers
baseYesTarget branch name
bodyNoPull Request content
headYesSource branch name
issueNoRelated issue, format: #xxx
labelsNoLabels
milestone_numberNoMilestone number
ownerYesRepository owner path (enterprise, organization, or personal path)
prune_source_branchNoWhether to delete the source branch after merging
repoYesRepository path
testersNoTesters
titleYesPull Request title

Implementation Reference

  • The core function that implements the createPullRequest tool by validating inputs and making a POST request to the Gitee API to create a pull request.
    export async function createPullRequest(options: CreatePullRequestOptions) { const { owner, repo, ...rest } = options; const validatedOwner = validateOwnerName(owner); const validatedRepo = validateRepositoryName(repo); const validatedHead = validateBranchName(rest.head); const validatedBase = validateBranchName(rest.base); const url = `/repos/${validatedOwner}/${validatedRepo}/pulls`; const body = { ...rest, head: validatedHead, base: validatedBase, }; const response = await giteeRequest(url, "POST", body); return GiteePullRequestSchema.parse(response); }
  • Zod schema defining the input parameters for creating a pull request.
    export const CreatePullRequestSchema = z.object({ // 仓库所属空间地址 (企业、组织或个人的地址 path) owner: z.string().describe("Repository owner path (enterprise, organization, or personal path)"), // 仓库路径 (path) repo: z.string().describe("Repository path"), // Pull Request 标题 title: z.string().describe("Pull Request title"), // 源分支的名称 head: z.string().describe("Source branch name"), // 目标分支的名称 base: z.string().describe("Target branch name"), // Pull Request 内容 body: z.string().optional().describe("Pull Request content"), // 里程碑序号 milestone_number: z.number().optional().describe("Milestone number"), // 标签 labels: z.array(z.string()).optional().describe("Labels"), // 相关的 Issue,格式为 #xxx issue: z.string().optional().describe("Related issue, format: #xxx"), // 审查人员 assignees: z.array(z.string()).optional().describe("Reviewers"), // 测试人员 testers: z.array(z.string()).optional().describe("Testers"), // 合并后是否删除源分支 prune_source_branch: z.boolean().optional().describe("Whether to delete the source branch after merging"), });
  • index.ts:190-202 (registration)
    Registration of the 'create_pull_request' tool in the MCP server, including schema reference and handler wrapper that delegates to the pulls module.
    server.registerTool({ name: "create_pull_request", description: "在 Gitee 仓库中创建 Pull Request", schema: pullOperations.CreatePullRequestSchema, handler: async (params: any) => { const { owner, repo, ...rest } = params; // 确保 owner 和 repo 参数存在 if (!owner || !repo) { throw new Error("owner 和 repo 参数是必需的"); } return await pullOperations.createPullRequest({ owner, repo, ...rest }); }, });

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