Skip to main content
Glama
MementoRC

MCP Git Server

by MementoRC

github_get_workflow_run

Retrieve detailed information about a GitHub Actions workflow run, including logs if specified, using repository owner, name, and run ID inputs.

Instructions

Get detailed workflow run information

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
include_logsNo
repo_nameYes
repo_ownerYes
run_idYes

Implementation Reference

  • The core handler function that implements the github_get_workflow_run tool. Fetches workflow run details and associated jobs from the GitHub Actions API, formats them with status emojis and timing information.
    async def github_get_workflow_run(
        repo_owner: str, repo_name: str, run_id: int, include_logs: bool = False
    ) -> str:
        """Get detailed workflow run information"""
        try:
            async with github_client_context() as client:
                # Get workflow run details
                run_response = await client.get(
                    f"/repos/{repo_owner}/{repo_name}/actions/runs/{run_id}"
                )
                if run_response.status != 200:
                    return f"❌ Failed to get workflow run #{run_id}: {run_response.status}"
    
                run_data = await run_response.json()
    
                output = [f"Workflow Run #{run_id}:\n"]
                output.append(f"Name: {run_data.get('name', 'N/A')}")
                output.append(f"Status: {run_data.get('status', 'N/A')}")
                output.append(f"Conclusion: {run_data.get('conclusion', 'N/A')}")
                output.append(f"Branch: {run_data.get('head_branch', 'N/A')}")
                output.append(f"Commit: {run_data.get('head_sha', 'N/A')[:8]}")
                output.append(f"Started: {run_data.get('created_at', 'N/A')}")
                output.append(f"Updated: {run_data.get('updated_at', 'N/A')}")
    
                if run_data.get("html_url"):
                    output.append(f"URL: {run_data['html_url']}")
    
                # Get jobs if available
                jobs_response = await client.get(
                    f"/repos/{repo_owner}/{repo_name}/actions/runs/{run_id}/jobs"
                )
                if jobs_response.status == 200:
                    jobs_data = await jobs_response.json()
                    jobs = jobs_data.get("jobs", [])
    
                    if jobs:
                        output.append("\nJobs:")
                        for job in jobs:
                            status_emoji = {
                                "completed": "✅"
                                if job.get("conclusion") == "success"
                                else "❌",
                                "in_progress": "🔄",
                                "queued": "⏳",
                            }.get(job["status"], "❓")
    
                            output.append(f"  {status_emoji} {job['name']}")
                            output.append(f"    Status: {job['status']}")
                            if job.get("conclusion"):
                                output.append(f"    Conclusion: {job['conclusion']}")
    
                return "\n".join(output)
    
        except ValueError as auth_error:
            logger.error(f"Authentication error getting workflow run: {auth_error}")
            return f"❌ {str(auth_error)}"
        except ConnectionError as conn_error:
            logger.error(f"Connection error getting workflow run: {conn_error}")
            return f"❌ Network connection failed: {str(conn_error)}"
        except Exception as e:
            logger.error(
                f"Unexpected error getting workflow run #{run_id}: {e}", exc_info=True
            )
            return f"❌ Error getting workflow run: {str(e)}"
  • Pydantic model defining the input schema for the github_get_workflow_run tool, including required repository details and run_id, with optional include_logs flag.
    class GitHubGetWorkflowRun(BaseModel):
        repo_owner: str
        repo_name: str
        run_id: int
        include_logs: bool = False
  • Registration of the tool handler in the GitToolRouter. Creates a wrapped async handler using _create_github_handler that calls the api implementation with proper argument mapping and error handling.
    "github_get_workflow_run": self._create_github_handler(
        github_get_workflow_run,
        ["repo_owner", "repo_name", "run_id", "include_logs"],
    ),
  • ToolDefinition registration in the central ToolRegistry. Defines the tool metadata, schema reference, category (GITHUB), and flags for repo/token requirements. Handler placeholder later replaced by router.
        name=GitTools.GITHUB_GET_WORKFLOW_RUN,
        category=ToolCategory.GITHUB,
        description="Get detailed workflow run information",
        schema=GitHubGetWorkflowRun,
        handler=placeholder_handler,
        requires_repo=False,
        requires_github_token=True,
    ),
  • Enum definition in GitTools that provides the canonical string name for the tool used in registrations.
    GITHUB_GET_WORKFLOW_RUN = "github_get_workflow_run"

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