update_issue
Modify Gitee repository issues by updating title, content, assignees, labels, milestone, or state to manage and organize tasks efficiently.
Instructions
更新 Gitee 仓库中的 Issue
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"owner": "<owner>",
"repo": "<repo>",
"issue_number": "<issue_number>"
},
"name": "update_issue"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignees | No | Users assigned to the issue | |
| body | No | Issue content | |
| issue_number | Yes | Issue number | |
| labels | No | Labels | |
| milestone | No | Milestone ID | |
| owner | Yes | Repository owner path (enterprise, organization, or personal path) | |
| repo | Yes | Repository path | |
| state | No | Issue state | |
| title | No | Issue title |
Implementation Reference
- operations/issues.ts:173-209 (handler)The core handler function implementing the update_issue tool logic, calling the Gitee API to update an issue.
export async function updateIssue( owner: string, repo: string, issueNumber: number | string, options: Omit<UpdateIssueOptions, "owner" | "repo" | "issue_number"> ) { owner = validateOwnerName(owner); repo = validateRepositoryName(repo); // Create the request body const body: Record<string, any> = { ...options, repo: repo // Add repo as a request body parameter }; // If `assignees` is an array, convert it to a comma-separated string. if (Array.isArray(body.assignees) && body.assignees.length > 0) { body.assignees = body.assignees.join(','); } else if (Array.isArray(body.assignees) && body.assignees.length === 0) { // If `assignees` is an empty array, delete the field. delete body.assignees; } // If `labels` is an array, convert it to a comma-separated string. if (Array.isArray(body.labels) && body.labels.length > 0) { body.labels = body.labels.join(','); } else if (Array.isArray(body.labels) && body.labels.length === 0) { // If `labels` is an empty array, delete the field. delete body.labels; } // Note: In the Gitee API's update issue interface, `repo` is passed as a form parameter, not as a path parameter. const url = `/repos/${owner}/issues/${issueNumber}`; const response = await giteeRequest(url, "PATCH", body); return GiteeIssueSchema.parse(response); } - operations/issues.ts:61-80 (schema)Zod schema defining the input parameters for the update_issue tool.
export const UpdateIssueOptionsSchema = z.object({ // 仓库所属空间地址 (企业、组织或个人的地址 path) owner: z.string().describe("Repository owner path (enterprise, organization, or personal path)"), // 仓库路径 (path) repo: z.string().describe("Repository path"), // Issue 编号 issue_number: z.union([z.number(), z.string()]).describe("Issue number"), // Issue 标题 title: z.string().optional().describe("Issue title"), // Issue 内容 body: z.string().optional().describe("Issue content"), // Issue 分配的用户 assignees: z.array(z.string()).optional().describe("Users assigned to the issue"), // 里程碑 ID milestone: z.number().optional().describe("Milestone ID"), // 标签 labels: z.array(z.string()).optional().describe("Labels"), // Issue 状态 state: z.enum(["open", "closed", "progressing"]).optional().describe("Issue state"), }); - index.ts:169-177 (registration)Registration of the 'update_issue' tool in the MCP server, referencing the schema and delegating to the handler.
server.registerTool({ name: "update_issue", description: "更新 Gitee 仓库中的 Issue", schema: issueOperations.UpdateIssueOptionsSchema, handler: async (params: any) => { const { owner, repo, issue_number, ...options } = params; return await issueOperations.updateIssue(owner, repo, issue_number, options); }, });