Skip to main content
Glama
saidsef

GitHub PR Issue Analyser

by saidsef

create_pr

Create a new pull request in a GitHub repository by specifying the owner, repo, title, body, head branch, base branch, and optional draft status.

Instructions

Creates a new pull request in the specified GitHub repository. Args: repo_owner (str): The owner of the repository. repo_name (str): The name of the repository. title (str): The title of the pull request. body (str): The body content of the pull request. head (str): The name of the branch where your changes are implemented. base (str): The name of the branch you want the changes pulled into. draft (bool, optional): Whether the pull request is a draft. Defaults to False. Returns: Dict[str, Any]: The JSON response from the GitHub API containing pull request information if successful. Error Handling: Logs errors and prints the traceback if the pull request creation fails, returning None.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repo_ownerYes
repo_nameYes
titleYes
bodyYes
headYes
baseYes
draftNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
titleYes
descriptionYes
authorYes
created_atYes
updated_atYes
stateYes

Implementation Reference

  • The create_pr method on GitHubIntegration class - sends POST to /repos/{owner}/{repo}/pulls to create a pull request with title, body, head, base, draft params. Returns PR url, number, status, and title.
    def create_pr(
        self,
        repo_owner: str,
        repo_name: str,
        title: str,
        body: str,
        head: str,
        base: str,
        draft: bool = False,
    ) -> PRContent:
        """
        Creates a new pull request in the specified GitHub repository.
        Args:
            repo_owner (str): The owner of the repository.
            repo_name (str): The name of the repository.
            title (str): The title of the pull request.
            body (str): The body content of the pull request.
            head (str): The name of the branch where your changes are implemented.
            base (str): The name of the branch you want the changes pulled into.
            draft (bool, optional): Whether the pull request is a draft. Defaults to False.
        Returns:
            Dict[str, Any]: The JSON response from the GitHub API containing pull request information if successful.
        Error Handling:
            Logs errors and prints the traceback if the pull request creation fails, returning None.
        """
        logger.info(f"Creating PR in {repo_owner}/{repo_name}")
    
        pr_url = f"https://api.github.com/repos/{repo_owner}/{repo_name}/pulls"
    
        try:
            response = httpx.post(
                pr_url,
                headers=self._get_headers(),
                json={
                    "title": title,
                    "body": body,
                    "head": head,
                    "base": base,
                    "draft": draft,
                },
                timeout=TIMEOUT,
            )
            self._raise_for_status(response, f"create PR {head} -> {base}")
            pr_data = response.json()
    
            logger.info("PR created successfully")
            return {
                "pr_url": pr_data.get("html_url"),
                "pr_number": pr_data.get("number"),
                "status": pr_data.get("state"),
                "title": pr_data.get("title"),
            }
    
        except GitHubAuthError:
            raise
        except Exception as e:
            logger.error(f"Error creating PR: {str(e)}")
            traceback.print_exc()
            return {"status": "error", "message": str(e)}
  • PRContent TypedDict - defines the return type shape for PR operations including title, description, author, created_at, updated_at, state.
    type PRContent = TypedDict(
        "PRContent",
        {  # pyright: ignore[reportInvalidTypeForm]
            "title": str,
            "description": str | None,
            "author": str,
            "created_at": str,
            "updated_at": str,
            "state": str,
        },
    )
  • Registration mechanism: _register_tools() calls register_tools(self.gi) which iterates all non-underscore methods of GitHubIntegration and registers them as MCP tools via self.mcp.add_tool(method). This is how create_pr gets registered as an MCP tool.
    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 are provided, so the description carries full burden. It discloses creation behavior, return type (dict on success, None on failure), error logging, and optional draft parameter. No contradictions.

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 sections for args, returns, and error handling. Slightly verbose but each sentence adds value; not overly concise but efficient.

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?

With 7 parameters and an output schema (present but not detailed), the description adequately covers parameter semantics, return behavior, and error handling. Could mention prerequisites or side effects, but sufficient.

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%, yet the description thoroughly explains each parameter's purpose, including types and optionality, adding significant value beyond the raw schema.

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 explicitly states it creates a new pull request in a specified GitHub repository, using clear verb+resource. It distinguishes from sibling tools like 'merge_pr' or 'update_pr_description'.

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 for creating PRs but does not provide explicit when-to-use or when-not-to-use guidance compared to alternatives. No prerequisites or context are mentioned.

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