Skip to main content
Glama
ddukbg

GitHub Enterprise MCP Server

list-workflow-runs

Retrieve and filter workflow runs from a GitHub repository by owner, repo, workflow ID, branch, or status using the GitHub Enterprise MCP Server.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
branchNoFilter by branch name
ownerYesRepository owner
pageNoPage number
perPageNoItems per page
repoYesRepository name
statusNoFilter by run status
workflow_idNoWorkflow ID or file name

Implementation Reference

  • Main handler function for the 'list-workflow-runs' tool. Validates parameters, calls ActionsAPI.listWorkflowRuns, formats the response using formatWorkflowRun, and returns formatted MCP content.
    async ({ owner, repo, workflow_id, branch, status, page, perPage }) => { try { // Parameter validation if (!owner || typeof owner !== 'string' || owner.trim() === '') { return { content: [ { type: "text", text: "Repository owner is required." } ] }; } if (!repo || typeof repo !== 'string' || repo.trim() === '') { return { content: [ { type: "text", text: "Repository name is required." } ] }; } const response = await context.actions.listWorkflowRuns(owner, repo, { workflow_id, branch, status, page, per_page: perPage }); if (!response.workflow_runs || response.workflow_runs.length === 0) { return { content: [ { type: "text", text: workflow_id ? `No workflow runs found for workflow '${workflow_id}' in repository '${owner}/${repo}'.` : `No workflow runs found in repository '${owner}/${repo}'.` } ] }; } const formattedRuns = response.workflow_runs.map(formatWorkflowRun); return { content: [ { type: "text", text: `${workflow_id ? `Workflow '${workflow_id}'` : 'Workflow'} runs in repository '${owner}/${repo}' (${response.total_count}):\n\n${JSON.stringify(formattedRuns, null, 2)}` } ] }; } catch (error: any) { return { content: [ { type: "text", text: `Error listing workflow runs: ${error.message}` } ] }; } }
  • Zod input schema defining parameters for the list-workflow-runs tool.
    owner: z.string().min(1).describe("Repository owner"), repo: z.string().min(1).describe("Repository name"), workflow_id: z.union([z.string(), z.number()]).optional().describe("Workflow ID or file name"), branch: z.string().optional().describe("Filter by branch name"), status: z.enum(['completed', 'action_required', 'cancelled', 'failure', 'neutral', 'skipped', 'stale', 'success', 'timed_out', 'in_progress', 'queued', 'requested', 'waiting']).optional().describe("Filter by run status"), page: z.number().int().positive().optional().describe("Page number"), perPage: z.number().int().positive().optional().describe("Items per page") },
  • Registration of the 'list-workflow-runs' MCP tool using McpServer.tool() method.
    "list-workflow-runs", { owner: z.string().min(1).describe("Repository owner"), repo: z.string().min(1).describe("Repository name"), workflow_id: z.union([z.string(), z.number()]).optional().describe("Workflow ID or file name"), branch: z.string().optional().describe("Filter by branch name"), status: z.enum(['completed', 'action_required', 'cancelled', 'failure', 'neutral', 'skipped', 'stale', 'success', 'timed_out', 'in_progress', 'queued', 'requested', 'waiting']).optional().describe("Filter by run status"), page: z.number().int().positive().optional().describe("Page number"), perPage: z.number().int().positive().optional().describe("Items per page") }, async ({ owner, repo, workflow_id, branch, status, page, perPage }) => { try { // Parameter validation if (!owner || typeof owner !== 'string' || owner.trim() === '') { return { content: [ { type: "text", text: "Repository owner is required." } ] }; } if (!repo || typeof repo !== 'string' || repo.trim() === '') { return { content: [ { type: "text", text: "Repository name is required." } ] }; } const response = await context.actions.listWorkflowRuns(owner, repo, { workflow_id, branch, status, page, per_page: perPage }); if (!response.workflow_runs || response.workflow_runs.length === 0) { return { content: [ { type: "text", text: workflow_id ? `No workflow runs found for workflow '${workflow_id}' in repository '${owner}/${repo}'.` : `No workflow runs found in repository '${owner}/${repo}'.` } ] }; } const formattedRuns = response.workflow_runs.map(formatWorkflowRun); return { content: [ { type: "text", text: `${workflow_id ? `Workflow '${workflow_id}'` : 'Workflow'} runs in repository '${owner}/${repo}' (${response.total_count}):\n\n${JSON.stringify(formattedRuns, null, 2)}` } ] }; } catch (error: any) { return { content: [ { type: "text", text: `Error listing workflow runs: ${error.message}` } ] }; } } );
  • ActionsAPI.listWorkflowRuns method: core helper that makes the GitHub API call to list workflow runs.
    async listWorkflowRuns(owner: string, repo: string, options: { workflow_id?: number | string; actor?: string; branch?: string; event?: string; status?: 'completed' | 'action_required' | 'cancelled' | 'failure' | 'neutral' | 'skipped' | 'stale' | 'success' | 'timed_out' | 'in_progress' | 'queued' | 'requested' | 'waiting'; created?: string; page?: number; per_page?: number; } = {}): Promise<GitHubWorkflowRunListResponse> { const endpoint = options.workflow_id ? `repos/${owner}/${repo}/actions/workflows/${options.workflow_id}/runs` : `repos/${owner}/${repo}/actions/runs`; const { workflow_id, ...params } = options; return this.client.get<GitHubWorkflowRunListResponse>(endpoint, { params }); }
  • formatWorkflowRun helper function: formats individual workflow run data for user-friendly JSON output.
    function formatWorkflowRun(run: any) { return { id: run.id, name: run.name, workflow_id: run.workflow_id, run_number: run.run_number, event: run.event, status: run.status, conclusion: run.conclusion, created_at: run.created_at, updated_at: run.updated_at, url: run.html_url, head_branch: run.head_branch, head_sha: run.head_sha, run_attempt: run.run_attempt }; }

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/ddukbg/github-enterprise-mcp'

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