Skip to main content
Glama

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
NameRequiredDescriptionDefault
assigneesNoUsers assigned to the issue
bodyNoIssue content
labelsNoLabels
milestoneNoMilestone ID
ownerYesRepository owner path (enterprise, organization, or personal path)
repoYesRepository path
security_holeNoWhether the issue is private, default is false
titleYesIssue title

Implementation Reference

  • 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);
    }
  • 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);
      },
    });

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