gitea_issue_create
Create new issues in Gitea repositories with AI-assisted content generation for efficient project management and bug tracking.
Instructions
Create a new issue. Use this tool for AI-assisted issue creation with smart content generation.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | No | Repository owner. Uses context if not provided | |
| repo | No | Repository name. Uses context if not provided | |
| title | Yes | Issue title | |
| body | No | Issue body/description | |
| assignees | No | Usernames to assign | |
| labels | No | Label IDs to attach | |
| milestone | No | Milestone ID | |
| token | No | Optional API token to override default authentication |
Implementation Reference
- src/tools/issue.ts:31-90 (handler)Core handler function that resolves repository context, constructs CreateIssueOptions, makes POST request to Gitea API to create issue, and returns formatted success response with issue details.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, }, }; }
- src/tools-registry/issue-registry.ts:33-64 (registration)Registers the MCP tool 'gitea_issue_create' with mcpServer.registerTool, providing title, description, Zod inputSchema, and an async wrapper handler that delegates to IssueTools.createIssue and handles errors.// gitea_issue_create - 创建 Issue (智能内容生成) 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, }; } } );
- Zod schema defining the input parameters for the gitea_issue_create tool, including optional owner/repo (context-resolved), required title, and optional body, assignees, labels, milestone, token.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, }),