Skip to main content
Glama
ddukbg

GitHub Enterprise MCP Server

list-workflow-runs

Retrieve and filter workflow execution history for GitHub repositories to monitor CI/CD pipeline status and troubleshoot builds.

Input Schema

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

Implementation Reference

  • Tool registration including input schema (zod) and handler function that calls ActionsAPI.listWorkflowRuns
    server.tool(
      "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: core method that makes the GitHub API request for 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: utility function to format workflow run data for user-friendly 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
      };
    }
  • Zod input schema for the list-workflow-runs tool parameters
      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")
    },
Behavior1/5

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

Tool has no description.

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

Conciseness1/5

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

Tool has no description.

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

Completeness1/5

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

Tool has no description.

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

Parameters1/5

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

Tool has no description.

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

Purpose1/5

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

Tool has no description.

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

Usage Guidelines1/5

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

Tool has no description.

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

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