Skip to main content
Glama
MementoRC

MCP Git Server

by MementoRC

github_get_failing_jobs

Retrieve detailed insights into failing jobs within a GitHub pull request, including logs and annotations, to identify and resolve issues efficiently.

Instructions

Get detailed information about failing jobs in a PR

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_annotationsNo
include_logsNo
pr_numberYes
repo_nameYes
repo_ownerYes

Implementation Reference

  • Core async function implementing the github_get_failing_jobs tool logic: fetches PR details, check-runs for the head commit, filters failing jobs, retrieves annotations and provides log links.
    async def github_get_failing_jobs(
        repo_owner: str,
        repo_name: str,
        pr_number: int,
        include_logs: bool = True,
        include_annotations: bool = True,
    ) -> str:
        """Get detailed information about failing jobs in a PR"""
        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"]
    
                # Get check runs and filter for failures
                checks_response = await client.get(
                    f"/repos/{repo_owner}/{repo_name}/commits/{head_sha}/check-runs"
                )
                if checks_response.status != 200:
                    return f"❌ Failed to get check runs: {checks_response.status}"
    
                checks_data = await checks_response.json()
    
                failing_runs = [
                    run
                    for run in checks_data.get("check_runs", [])
                    if run["status"] == "completed"
                    and run.get("conclusion") in ["failure", "cancelled", "timed_out"]
                ]
    
                if not failing_runs:
                    return f"No failing jobs found for PR #{pr_number}"
    
                output = [f"Failing jobs for PR #{pr_number}:\n"]
    
                for run in failing_runs:
                    output.append(f"❌ {run['name']}")
                    output.append(f"   Conclusion: {run['conclusion']}")
                    output.append(f"   Started: {run.get('started_at', 'N/A')}")
                    output.append(f"   Completed: {run.get('completed_at', 'N/A')}")
    
                    # Get annotations if requested
                    if include_annotations and run.get("id"):
                        try:
                            annotations_response = await client.get(
                                f"/repos/{repo_owner}/{repo_name}/check-runs/{run['id']}/annotations"
                            )
                            if annotations_response.status == 200:
                                annotations_data = await annotations_response.json()
                                if annotations_data:
                                    output.append("   Annotations:")
                                    for annotation in annotations_data[
                                        :5
                                    ]:  # Limit to first 5
                                        output.append(
                                            f"     • {annotation.get('title', 'Error')}: {annotation.get('message', 'No message')}"
                                        )
                                        if annotation.get("path"):
                                            output.append(
                                                f"       File: {annotation['path']} (line {annotation.get('start_line', 'unknown')})"
                                            )
                        except (ConnectionError, ValueError) as annotation_error:
                            # Log specific annotation errors but continue processing
                            logger.warning(
                                f"Failed to get annotations for run {run.get('id')}: {annotation_error}"
                            )
                        except Exception as annotation_error:
                            # Annotations might not be available - log but continue
                            logger.debug(
                                f"Annotations unavailable for run {run.get('id')}: {annotation_error}"
                            )
    
                    # Get logs if requested (simplified)
                    if include_logs and run.get("html_url"):
                        output.append(f"   Details: {run['html_url']}")
    
                    output.append("")
    
                return "\n".join(output)
    
        except ValueError as auth_error:
            logger.error(f"Authentication error getting failing jobs: {auth_error}")
            return f"❌ {str(auth_error)}"
        except ConnectionError as conn_error:
            logger.error(f"Connection error getting failing jobs: {conn_error}")
            return f"❌ Network connection failed: {str(conn_error)}"
        except Exception as e:
            logger.error(
                f"Unexpected error getting failing jobs for PR #{pr_number}: {e}",
                exc_info=True,
            )
            return f"❌ Error getting failing jobs: {str(e)}"
  • Pydantic input schema/model for the github_get_failing_jobs tool defining required repo_owner, repo_name, pr_number and optional flags for logs/annotations.
    class GitHubGetFailingJobs(BaseModel):
        repo_owner: str
        repo_name: str
        pr_number: int
        include_logs: bool = True
        include_annotations: bool = True
  • ToolDefinition registration in ToolRegistry for github_get_failing_jobs including name, category, description, schema, and flags.
        name=GitTools.GITHUB_GET_FAILING_JOBS,
        category=ToolCategory.GITHUB,
        description="Get detailed information about failing jobs in a PR",
        schema=GitHubGetFailingJobs,
        handler=placeholder_handler,
        requires_repo=False,
        requires_github_token=True,
    ),
  • Handler registration in _get_github_handlers: creates GitHub handler wrapper around imported github_get_failing_jobs function with specific arg order.
    "github_get_failing_jobs": self._create_github_handler(
        github_get_failing_jobs,
        [
            "repo_owner",
            "repo_name",
            "pr_number",
            "include_logs",
            "include_annotations",
        ],
    ),
  • Enum constant definition for the tool name in GitTools.
    GITHUB_GET_FAILING_JOBS = "github_get_failing_jobs"
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It states the tool retrieves 'detailed information' but doesn't specify what that includes beyond the implied job data, nor does it mention rate limits, authentication needs, or potential side effects. This leaves significant gaps in understanding the tool's behavior and constraints.

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, direct sentence that efficiently conveys the core purpose without unnecessary words. It's front-loaded with the main action and target, making it easy to parse quickly, which is ideal for conciseness in tool descriptions.

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?

Given the complexity (5 parameters, no output schema, and no annotations), the description is insufficient. It lacks details on parameter meanings, return values, error handling, and behavioral traits, making it incomplete for effective tool selection and invocation by an AI agent in this context.

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?

The schema description coverage is 0%, meaning none of the 5 parameters have descriptions in the schema. The tool description doesn't explain any parameters, such as what 'repo_owner' or 'include_logs' mean in context, failing to compensate for the lack of schema documentation and leaving parameters semantically unclear.

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 detailed information') and the target ('about failing jobs in a PR'), making the purpose immediately understandable. However, it doesn't explicitly differentiate this tool from sibling tools like 'github_get_pr_checks' or 'github_get_pr_status', which might also provide related PR status information, so it doesn't reach the highest score.

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?

The description provides no guidance on when to use this tool versus alternatives. It doesn't mention prerequisites (e.g., needing a PR number), exclusions, or how it differs from similar sibling tools like 'github_get_pr_checks', leaving the agent to infer usage context without explicit direction.

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