Skip to main content
Glama

gitea_issue_create

Create new issues in Gitea repositories with AI-assisted content generation for bug reports, feature requests, and task tracking.

Instructions

Create a new issue. Use this tool for AI-assisted issue creation with smart content generation.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerNoRepository owner. Uses context if not provided
repoNoRepository name. Uses context if not provided
titleYesIssue title
bodyNoIssue body/description
assigneesNoUsernames to assign
labelsNoLabel IDs to attach
milestoneNoMilestone ID
tokenNoOptional API token to override default authentication

Implementation Reference

  • Core handler function that executes the gitea_issue_create tool logic: resolves repo context, prepares options, calls Gitea API to create issue, formats and returns result.
    export async function createIssue(
      ctx: IssueToolsContext,
      args: {
        owner?: string;
        repo?: string;
        title: string;
        body?: string;
        assignee?: string;
        assignees?: string[];
        milestone?: number;
        labels?: number[];
        due_date?: string;
        token?: string;
      }
    ) {
      logger.debug({ args }, 'Creating issue');
    
      const { owner, repo } = ctx.contextManager.resolveOwnerRepo(args.owner, args.repo);
    
      const createOptions: CreateIssueOptions = {
        title: args.title,
        body: args.body,
        assignee: args.assignee,
        assignees: args.assignees,
        milestone: args.milestone,
        labels: args.labels,
        due_date: args.due_date,
      };
    
      const issue = await ctx.client.post<GiteaIssue>(
        `/repos/${owner}/${repo}/issues`,
        createOptions,
        args.token
      );
    
      logger.info({ owner, repo, issue: issue.number }, 'Issue created successfully');
    
      return {
        success: true,
        issue: {
          id: issue.id,
          number: issue.number,
          title: issue.title,
          body: issue.body,
          state: issue.state,
          user: {
            id: issue.user.id,
            login: issue.user.login,
          },
          labels: issue.labels.map((l) => ({ id: l.id, name: l.name, color: l.color })),
          assignees: issue.assignees?.map((a) => ({ id: a.id, login: a.login })),
          milestone: issue.milestone
            ? { id: issue.milestone.id, title: issue.milestone.title }
            : null,
          html_url: issue.html_url,
          created_at: issue.created_at,
          updated_at: issue.updated_at,
        },
      };
    }
  • Registers the 'gitea_issue_create' MCP tool, defines its metadata, input schema (Zod), and thin async handler that delegates to the core createIssue function.
    mcpServer.registerTool(
      'gitea_issue_create',
      {
        title: '创建 Issue',
        description: 'Create a new issue. Use this tool for AI-assisted issue creation with smart content generation.',
        inputSchema: z.object({
          owner: z.string().optional().describe('Repository owner. Uses context if not provided'),
          repo: z.string().optional().describe('Repository name. Uses context if not provided'),
          title: z.string().min(1).describe('Issue title'),
          body: z.string().optional().describe('Issue body/description'),
          assignees: z.array(z.string()).optional().describe('Usernames to assign'),
          labels: z.array(z.number()).optional().describe('Label IDs to attach'),
          milestone: z.number().optional().describe('Milestone ID'),
          token: tokenSchema,
        }),
      },
      async (args) => {
        try {
          const result = await IssueTools.createIssue(toolsContext, args as any);
          return {
            content: [{ type: 'text' as const, text: JSON.stringify(result, null, 2) }],
          };
        } catch (error: unknown) {
          const errorMessage = error instanceof Error ? error.message : String(error);
          return {
            content: [{ type: 'text' as const, text: `Error: ${errorMessage}` }],
            isError: true,
          };
        }
      }
    );
  • src/index.ts:119-121 (registration)
    Calls registerIssueTools to include the gitea_issue_create tool during MCP server initialization.
    // 智能内容生成 (2个): gitea_issue_create, gitea_pr_create
    registerIssueTools(mcpServer, toolContext);
    registerPullRequestTools(mcpServer, toolContext);

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/SupenBysz/gitea-mcp-tool'

If you have feedback or need assistance with the MCP directory API, please join our Discord server