update_pull_request
Modify and manage Gitee repository Pull Requests by updating titles, content, states, labels, assignees, or milestones directly through the MCP server.
Instructions
更新 Gitee 仓库中的 Pull Request
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignees | No | Reviewers | |
| body | No | Pull Request content | |
| labels | No | Labels | |
| milestone_number | No | Milestone number | |
| owner | Yes | Repository owner path (enterprise, organization, or personal path) | |
| pull_number | Yes | Pull Request number | |
| repo | Yes | Repository path | |
| state | No | Pull Request state | |
| testers | No | Testers | |
| title | No | Pull Request title |
Implementation Reference
- operations/pulls.ts:162-175 (handler)The core handler function that performs the actual update_pull_request logic by validating inputs and making a PATCH request to the Gitee API.
export async function updatePullRequest( owner: string, repo: string, pullNumber: number, options: Omit<UpdatePullRequestOptions, "owner" | "repo" | "pull_number"> ) { owner = validateOwnerName(owner); repo = validateRepositoryName(repo); const url = `/repos/${owner}/${repo}/pulls/${pullNumber}`; const response = await giteeRequest(url, "PATCH", options); return GiteePullRequestSchema.parse(response); } - operations/pulls.ts:63-84 (schema)Zod schema defining the input structure and validation for the update_pull_request tool.
export const UpdatePullRequestSchema = 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"), // Pull Request 标题 title: z.string().optional().describe("Pull Request title"), // Pull Request 内容 body: z.string().optional().describe("Pull Request content"), // Pull Request 状态 state: z.enum(["open", "closed"]).optional().describe("Pull Request state"), // 里程碑序号 milestone_number: z.number().optional().describe("Milestone number"), // 标签 labels: z.array(z.string()).optional().describe("Labels"), // 审查人员 assignees: z.array(z.string()).optional().describe("Reviewers"), // 测试人员 testers: z.array(z.string()).optional().describe("Testers"), }); - index.ts:224-236 (registration)Tool registration in the MCP server, which wraps and delegates to the updatePullRequest handler from pullOperations.
server.registerTool({ name: "update_pull_request", description: "更新 Gitee 仓库中的 Pull Request", schema: pullOperations.UpdatePullRequestSchema, 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.updatePullRequest(owner, repo, pull_number, options); }, });