create_issue
Create and manage Issues in Gitee repositories by specifying owner, repo, title, body, assignees, milestones, and labels.
Instructions
在 Gitee 仓库中创建 Issue
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| assignees | No | Users assigned to the issue | |
| body | No | Issue content | |
| labels | No | Labels | |
| milestone | No | Milestone ID | |
| owner | Yes | Repository owner path (enterprise, organization, or personal path) | |
| repo | Yes | Repository path | |
| security_hole | No | Whether the issue is private, default is false | |
| title | Yes | Issue title |
Implementation Reference
- operations/issues.ts:101-135 (handler)Main handler function implementing the logic to create a Gitee issue via API, including parameter validation, body preparation, and response parsing.export async function createIssue( owner: string, repo: string, options: Omit<CreateIssueOptions, "owner" | "repo"> ) { owner = validateOwnerName(owner); repo = validateRepositoryName(repo); // Create the request body const body: Record<string, any> = { ...options, repo: repo, }; // 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; } const url = `/repos/${owner}/${repo}/issues`; const response = await giteeRequest(url, "POST", body); return GiteeIssueSchema.parse(response); }
- operations/issues.ts:6-23 (schema)Zod schema defining the input parameters for creating an issue.export const CreateIssueSchema = z.object({ // 仓库所属空间地址 (企业、组织或个人的地址 path) owner: z.string().describe("Repository owner path (enterprise, organization, or personal path)"), // 仓库路径 (path) repo: z.string().describe("Repository path"), // Issue 标题 title: z.string().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,默认为 false security_hole: z.boolean().optional().describe("Whether the issue is private, default is false"), });
- index.ts:139-147 (registration)Tool registration in the MCP server, linking name, description, schema, and handler wrapper.server.registerTool({ name: "create_issue", description: "在 Gitee 仓库中创建 Issue", schema: issueOperations.CreateIssueSchema, handler: async (params: any) => { const { owner, repo, ...options } = params; return await issueOperations.createIssue(owner, repo, options); }, });