Skip to main content
Glama
saidsef

GitHub PR Issue Analyser

by saidsef

create_issue

Create a new GitHub issue in a repository with specified title, body, and labels. The issue link is automatically added to the related PR description.

Instructions

Creates a new issue in the specified GitHub repository. If the issue is created successfully, a link to the issue must be appended in the PR's description. Args: repo_owner (str): The owner of the repository. repo_name (str): The name of the repository. title (str): The title of the issue to be created. body (str): The body content of the issue. labels (list[str]): A list of labels to assign to the issue. The label 'mcp' will always be included. Returns: Dict[str, Any]: A dictionary containing the created issue's data if successful. None: If an error occurs during issue creation. Error Handling: Logs errors and prints the traceback if the issue creation fails, returning None.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_ownerYes
repo_nameYes
titleYes
bodyYes
labelsYes

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
idYes
numberYes
titleYes
bodyYes
stateYes
userYes
created_atYes
updated_atYes
labelsYes

Implementation Reference

  • The `create_issue` method on `GitHubIntegration` class — the core handler logic. It POSTs to the GitHub Issues API and returns the created issue data. Always appends the 'mcp' label.
    def create_issue(self, repo_owner: str, repo_name: str, title: str, body: str, labels: list[str]) -> IssueData:
        """
        Creates a new issue in the specified GitHub repository.
        If the issue is created successfully, a link to the issue must be appended in the PR's description.
        Args:
            repo_owner (str): The owner of the repository.
            repo_name (str): The name of the repository.
            title (str): The title of the issue to be created.
            body (str): The body content of the issue.
            labels (list[str]): A list of labels to assign to the issue. The label 'mcp' will always be included.
        Returns:
            Dict[str, Any]: A dictionary containing the created issue's data if successful.
            None: If an error occurs during issue creation.
        Error Handling:
            Logs errors and prints the traceback if the issue creation fails, returning None.
        """
        logger.info(f"Creating issue in {repo_owner}/{repo_name}")
    
        # Construct the issues URL
        issues_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/issues"
    
        try:
            # Create the issue
            issue_labels = ["mcp"] if not labels else labels + ["mcp"]
            response = httpx.post(
                issues_url,
                headers=self._get_headers(),
                json={"title": title, "body": body, "labels": issue_labels},
                timeout=TIMEOUT,
            )
            self._raise_for_status(response, f"create issue in {repo_owner}/{repo_name}")
            issue_data = response.json()
    
            logger.info("Issue created successfully")
            return issue_data
    
        except GitHubAuthError:
            raise
        except Exception as e:
            logger.error(f"Error creating issue: {str(e)}")
            traceback.print_exc()
            return {"status": "error", "message": str(e)}
  • The `IssueData` TypedDict defining the return type schema for `create_issue`.
    type IssueData = TypedDict(
        "IssueData",
        {  # pyright: ignore[reportInvalidTypeForm]
            "id": int,
            "number": int,
            "title": str,
            "body": str | None,
            "state": str,
            "user": dict[str, Any],
            "created_at": str,
            "updated_at": str,
            "labels": list[dict[str, Any]],
        },
    )
  • The `_register_tools` and `register_tools` methods that dynamically discover and register all public methods from `GitHubIntegration` (including `create_issue`) as MCP tools via `self.mcp.add_tool(method)`.
    def _register_tools(self):
        self.register_tools(self.gi)
        self.register_tools(self.ip)
        self.mcp.add_provider(SkillsDirectoryProvider(Path(__file__).parent / "skills"))
    
    def register_tools(self, methods: Any = None) -> None:
        for name in dir(methods):
            if name.startswith("_"):
                continue
            method = getattr(methods, name)
            if inspect.isroutine(method):
                self.mcp.add_tool(method)
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations provided, so description carries full burden. It discloses the mutation nature, a post-condition (appending link to PR description), and error handling behavior (logs, returns None). Missing authorization or rate limit details, but overall adequate.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is well-structured with Args, Returns, Error Handling sections, and front-loaded with the main action. However, it repeats parameter types already present in the schema (though schema has no descriptions), making it slightly verbose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the tool's complexity (5 required parameters, mutation, no annotations but has output schema), the description covers purpose, all parameters, return type, error handling, and a key post-condition. It is missing explicit sibling differentiation, which is addressed under guidelines.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0%, but the description provides complete parameter explanations with types and semantics, including the note that label 'mcp' is always added. This fully compensates for the missing schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool creates a new issue in a GitHub repository. It specifies the resource (new issue) and action (create), and differentiates from sibling 'update_issue' by implication.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage (e.g., when creating issues linked to PRs due to the post-condition about appending a link), but lacks explicit guidance on when to use versus alternatives like 'update_issue', and does not mention when not to use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

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/saidsef/mcp-github-pr-issue-analyser'

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