Skip to main content
Glama

create_draft_issue

Create draft issues in GitHub Projects V2 to capture and organize ideas before formal issue creation.

Instructions

Create a draft issue directly in a GitHub Project V2.

Args: owner: The GitHub organization or user name project_number: The project number title: The draft issue title body: The draft issue body (optional) Returns: A confirmation message with the new draft issue details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYes
project_numberYes
titleYes
bodyNo

Implementation Reference

  • The main handler function for the 'create_draft_issue' tool, decorated with @mcp.tool() for registration. It calls the GitHubClient helper to perform the action and handles errors.
    @mcp.tool() async def create_draft_issue( owner: str, project_number: int, title: str, body: str = "" ) -> str: """Create a draft issue directly in a GitHub Project V2. Args: owner: The GitHub organization or user name project_number: The project number title: The draft issue title body: The draft issue body (optional) Returns: A confirmation message with the new draft issue details """ try: result = await github_client.add_draft_issue_to_project( owner, project_number, title, body ) return ( f"Successfully created draft issue in project #{project_number}!\n" f"Item ID: {result['id']}\n" f"Title: {title}" ) except GitHubClientError as e: logger.error(f"Error creating draft issue in project {project_number}: {e}") return f"Error: Could not create draft issue. Details: {e}"
  • The core helper method in GitHubClient that executes the GraphQL mutation to create and add a draft issue to the specified project.
    async def add_draft_issue_to_project( self, owner: str, project_number: int, title: str, body: str = "" ) -> Dict[str, Any]: """Add a draft issue to a GitHub Project V2. Args: owner: The GitHub organization or user name that owns the project project_number: The project number title: The draft issue title body: The draft issue body (optional) Returns: The project item data Raises: GitHubClientError: If project not found or adding fails. """ # Get project ID try: project_id = await self.get_project_node_id(owner, project_number) except GitHubClientError as e: logger.error(f"Cannot add draft issue: {e}") raise # Add draft issue to project add_query = """ mutation AddDraftIssueToProject($projectId: ID!, $title: String!, $body: String) { addProjectV2DraftIssue(input: { projectId: $projectId, title: $title, body: $body }) { projectItem { id } } } """ variables = {"projectId": project_id, "title": title, "body": body} try: result = await self.execute_query(add_query, variables) if not result.get("addProjectV2DraftIssue") or not result[ "addProjectV2DraftIssue" ].get("projectItem"): raise GitHubClientError( f"Failed to add draft issue to project {project_number}" ) return result["addProjectV2DraftIssue"]["projectItem"] except GitHubClientError as e: logger.error(f"Failed to add draft issue to project {project_number}: {e}") raise

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/Arclio/github-projects-mcp'

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