create_draft_issue
Create draft issues directly in GitHub Projects v2 without needing repository issues first. Use this tool to add tasks with titles, descriptions, and assignees to project boards.
Instructions
Create a draft issue in a GitHub project. Draft issues are native to Projects v2 and don't require creating a repository issue first.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| projectId | Yes | ||
| title | Yes | ||
| body | No | ||
| assigneeIds | No |
Implementation Reference
- Implements the core logic for creating a draft issue in a GitHub project using GraphQL mutation addProjectV2DraftIssue. Handles input validation, API call, and error mapping.async createDraftIssue(data: { projectId: string; title: string; body?: string; assigneeIds?: string[]; }): Promise<{ id: string; title: string; body: string }> { try { const mutation = ` mutation($input: AddProjectV2DraftIssueInput!) { addProjectV2DraftIssue(input: $input) { projectV2Item { id content { ... on DraftIssue { id title body } } } } } `; interface AddDraftIssueResponse { addProjectV2DraftIssue: { projectV2Item: { id: string; content: { id: string; title: string; body: string; }; }; }; } const response = await this.factory.graphql<AddDraftIssueResponse>(mutation, { input: { projectId: data.projectId, title: data.title, body: data.body || '', assigneeIds: data.assigneeIds || [] } }); const content = response.addProjectV2DraftIssue.projectV2Item.content; return { id: content.id, title: content.title, body: content.body }; } catch (error) { throw this.mapErrorToMCPError(error); } }
- Defines the ToolDefinition for create_draft_issue including Zod input schema, description, and usage examples.export const createDraftIssueTool: ToolDefinition<CreateDraftIssueArgs> = { name: "create_draft_issue", description: "Create a draft issue in a GitHub project. Draft issues are native to Projects v2 and don't require creating a repository issue first.", schema: createDraftIssueSchema as unknown as ToolSchema<CreateDraftIssueArgs>, examples: [ { name: "Create draft task", description: "Create a draft issue for brainstorming without committing to the repository", args: { projectId: "PVT_kwDOLhQ7gc4AOEbH", title: "Explore new authentication options", body: "Research OAuth providers and compare features" } } ] };
- src/infrastructure/tools/ToolRegistry.ts:219-222 (registration)Registers the createDraftIssueTool (and related draft tools) in the central ToolRegistry singleton.// Register draft issue tools this.registerTool(createDraftIssueTool); this.registerTool(updateDraftIssueTool); this.registerTool(deleteDraftIssueTool);
- src/index.ts:333-334 (registration)Dispatches tool calls to the ProjectManagementService.createDraftIssue handler in the MCP server switch statement.case "create_draft_issue": return await this.service.createDraftIssue(args);