Skip to main content
Glama
MementoRC

MCP Git Server

by MementoRC

github_get_pr_status

Retrieve the status and check runs for a GitHub pull request by specifying the repository owner, name, and PR number.

Instructions

Get the status and check runs for a pull request

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
pr_numberYes
repo_nameYes
repo_ownerYes

Implementation Reference

  • Core implementation of the github_get_pr_status tool. Fetches PR state, mergeability, and check runs status from GitHub API using aiohttp client.
    async def github_get_pr_status(repo_owner: str, repo_name: str, pr_number: int) -> str:
        """Get the status and check runs for a pull request"""
        try:
            async with github_client_context() as client:
                # Get PR details
                pr_response = await client.get(
                    f"/repos/{repo_owner}/{repo_name}/pulls/{pr_number}"
                )
                if pr_response.status != 200:
                    return f"❌ Failed to get PR #{pr_number}: {pr_response.status}"
    
                pr_data = await pr_response.json()
                head_sha = pr_data["head"]["sha"]
    
                output = [f"Status for PR #{pr_number}:\n"]
                output.append(f"State: {pr_data.get('state', 'N/A')}")
                output.append(f"Mergeable: {pr_data.get('mergeable', 'N/A')}")
                output.append(f"Merge State: {pr_data.get('mergeable_state', 'N/A')}")
                output.append("")
    
                # Get check runs
                checks_response = await client.get(
                    f"/repos/{repo_owner}/{repo_name}/commits/{head_sha}/check-runs"
                )
                if checks_response.status == 200:
                    checks_data = await checks_response.json()
                    check_runs = checks_data.get("check_runs", [])
    
                    if check_runs:
                        output.append("Check Runs:")
                        for run in check_runs:
                            status_emoji = {
                                "completed": "✅"
                                if run.get("conclusion") == "success"
                                else "❌",
                                "in_progress": "🔄",
                                "queued": "⏳",
                            }.get(run["status"], "❓")
    
                            output.append(
                                f"  {status_emoji} {run['name']}: {run['status']}"
                            )
                            if run.get("conclusion"):
                                output.append(f"    Conclusion: {run['conclusion']}")
    
                return "\n".join(output)
    
        except ValueError as auth_error:
            logger.error(f"Authentication error getting PR status: {auth_error}")
            return f"❌ {str(auth_error)}"
        except ConnectionError as conn_error:
            logger.error(f"Connection error getting PR status: {conn_error}")
            return f"❌ Network connection failed: {str(conn_error)}"
        except Exception as e:
            logger.error(
                f"Unexpected error getting PR status for PR #{pr_number}: {e}",
                exc_info=True,
            )
            return f"❌ Error getting PR status: {str(e)}"
  • Pydantic model defining input schema for github_get_pr_status tool: repository owner, name, and PR number.
    class GitHubGetPRStatus(BaseModel):
        repo_owner: str
        repo_name: str
        pr_number: int
  • Registers the github_get_pr_status handler by wrapping the api function with error handling and argument mapping in the GitHub handlers dictionary.
    "github_get_pr_status": self._create_github_handler(
        github_get_pr_status, ["repo_owner", "repo_name", "pr_number"]
    ),
  • Registers tool metadata, schema, and description in the central ToolRegistry for github_get_pr_status.
    ToolDefinition(
        name=GitTools.GITHUB_GET_PR_STATUS,
        category=ToolCategory.GITHUB,
        description="Get the status and check runs for a pull request",
        schema=GitHubGetPRStatus,
        handler=placeholder_handler,
        requires_repo=False,
        requires_github_token=True,
    ),
  • Defines the constant name for the github_get_pr_status tool in GitTools enum.
    GITHUB_GET_PR_STATUS = "github_get_pr_status"
Behavior2/5

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

With no annotations, the description carries full burden but only states what the tool does, not how it behaves. It lacks details on permissions, rate limits, error handling, or response format, which are critical for a tool interacting with GitHub APIs.

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

Conciseness5/5

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

The description is a single, efficient sentence that front-loads the core purpose without unnecessary words. It's appropriately sized for the tool's complexity.

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

Completeness2/5

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

For a tool with 3 parameters, 0% schema coverage, no annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects, parameter meanings, or output expectations, leaving significant gaps for an AI agent.

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

Parameters2/5

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

Schema description coverage is 0%, so the description must compensate but adds no parameter information. It doesn't explain what 'pr_number', 'repo_name', or 'repo_owner' mean or how to format them, leaving parameters undocumented.

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

Purpose4/5

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

The description clearly states the action ('Get') and target ('status and check runs for a pull request'), making the purpose immediately understandable. It distinguishes from siblings like 'github_get_pr_details' or 'github_get_pr_checks' by specifying both status and check runs, though it doesn't explicitly contrast them.

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

Usage Guidelines2/5

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

No guidance is provided on when to use this tool versus alternatives like 'github_get_pr_checks' or 'github_get_pr_details'. The description implies usage for pull request status and check runs but offers no context on prerequisites, timing, or exclusions.

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

Related 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/MementoRC/mcp-git'

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