Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

list-workflows

Retrieve and display all workflow files from a GitHub repository to monitor automation processes, CI/CD pipelines, and scheduled tasks.

Instructions

List workflows in a GitHub repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner
pageNoPage number
perPageNoItems per page
repoYesRepository name

Implementation Reference

  • Main handler function that executes the list-workflows tool by validating inputs with Zod schema and calling the GitHub Actions API to list repository workflows.
    export async function listWorkflows(args: unknown): Promise<any> {
      const { owner, repo, page, perPage } = ListWorkflowsSchema.parse(args);
      const github = getGitHubApi();
    
      return tryCatchAsync(async () => {
        const { data } = await github.getOctokit().actions.listRepoWorkflows({
          owner,
          repo,
          page,
          per_page: perPage,
        });
    
        return {
          total_count: data.total_count,
          workflows: data.workflows.map((workflow) => ({
            id: workflow.id,
            name: workflow.name,
            path: workflow.path,
            state: workflow.state,
            created_at: workflow.created_at,
            updated_at: workflow.updated_at,
            url: workflow.html_url,
          })),
        };
      }, 'Failed to list workflows');
    }
  • Zod validation schema for list-workflows tool inputs, requiring owner and repo, with optional pagination parameters.
    export const ListWorkflowsSchema = OwnerRepoSchema.extend({
      page: z.number().int().optional(),
      perPage: z.number().int().optional(),
    });
  • src/server.ts:275-301 (registration)
    Tool registration in ListToolsRequestHandler, defining the tool name, description, and input schema for client discovery.
    {
      name: 'list-workflows',
      description: 'List workflows in a GitHub repository',
      inputSchema: {
        type: 'object',
        properties: {
          owner: {
            type: 'string',
            description: 'Repository owner',
          },
          repo: {
            type: 'string',
            description: 'Repository name',
          },
          page: {
            type: 'integer',
            description: 'Page number',
          },
          perPage: {
            type: 'integer',
            description: 'Items per page',
          },
        },
        required: ['owner', 'repo'],
        additionalProperties: false,
      },
    },
  • Switch case in CallToolRequestHandler that routes calls to the listWorkflows handler function.
    case 'list-workflows':
      result = await listWorkflows(parsedArgs);
      break;

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/piyushgIITian/github-enterprice-mcp'

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