Skip to main content
Glama

create_issue

Create a new GitHub issue in a specified repository by providing the owner, repository name, title, and optional body to track tasks, bugs, or feature requests.

Instructions

Create a new GitHub issue.

Args: owner: The GitHub organization or user name repo: The repository name title: The issue title body: The issue body (optional) Returns: A formatted string with the created issue details

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYes
repoYes
titleYes
bodyNo

Implementation Reference

  • MCP tool handler for 'create_issue'. Decorated with @mcp.tool() for registration and execution. Calls GitHubClient.create_issue and formats success/error response.
    @mcp.tool() async def create_issue(owner: str, repo: str, title: str, body: str = "") -> str: """Create a new GitHub issue. Args: owner: The GitHub organization or user name repo: The repository name title: The issue title body: The issue body (optional) Returns: A formatted string with the created issue details """ try: issue = await github_client.create_issue(owner, repo, title, body) return ( f"Issue created successfully!\n\n" f"Repository: {owner}/{repo}\n" f"Issue Number: #{issue['number']}\n" f"Title: {issue['title']}\n" f"URL: {issue['url']}\n" ) except GitHubClientError as e: logger.error(f"Error creating issue in {owner}/{repo}: {e}") return f"Error: Could not create issue in {owner}/{repo}. Details: {e}"
  • Helper function in GitHubClient that performs the actual GraphQL mutation to create the issue after fetching repository ID.
    async def create_issue( self, owner: str, repo: str, title: str, body: str = "" ) -> Dict[str, Any]: """Create a new GitHub issue. Args: owner: The GitHub organization or user name repo: The repository name title: The issue title body: The issue body (optional) Returns: The created issue data Raises: GitHubClientError: If repository is not found or issue creation fails. """ query = """ mutation CreateIssue($repositoryId: ID!, $title: String!, $body: String) { createIssue(input: { repositoryId: $repositoryId, title: $title, body: $body }) { issue { id number title url state } } } """ # First get the repository ID repo_query = """ query GetRepositoryId($owner: String!, $name: String!) { repository(owner: $owner, name: $name) { id } } """ repo_variables = {"owner": owner, "name": repo} try: repo_result = await self.execute_query(repo_query, repo_variables) if not repo_result.get("repository"): raise GitHubClientError(f"Repository {owner}/{repo} not found") except GitHubClientError as e: logger.error(f"Failed to get repository ID for {owner}/{repo}: {e}") raise repository_id = repo_result["repository"]["id"] variables = {"repositoryId": repository_id, "title": title, "body": body} try: result = await self.execute_query(query, variables) if not result.get("createIssue") or not result["createIssue"].get("issue"): raise GitHubClientError(f"Failed to create issue in {owner}/{repo}") return result["createIssue"]["issue"] except GitHubClientError as e: logger.error(f"Failed to create issue in {owner}/{repo}: {e}") raise
  • The @mcp.tool() decorator registers the create_issue function as an MCP tool.
    @mcp.tool()

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