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
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner | |
| page | No | Page number | |
| perPage | No | Items per page | |
| repo | Yes | Repository name |
Implementation Reference
- src/tools/repository.ts:282-307 (handler)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'); }
- src/utils/validation.ts:228-231 (schema)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, }, },
- src/server.ts:1181-1183 (registration)Switch case in CallToolRequestHandler that routes calls to the listWorkflows handler function.case 'list-workflows': result = await listWorkflows(parsedArgs); break;