rerun_workflow
Restart a failed GitHub Actions workflow run by specifying repository details and run ID to re-execute the pipeline.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner (username or organization) | |
| repo | Yes | Repository name | |
| runId | Yes | The ID of the workflow run |
Implementation Reference
- src/operations/actions.ts:264-277 (handler)The core handler function that performs input validation, constructs the GitHub API endpoint for rerunning a workflow run, sends the POST request, and returns a success response.
export async function rerunWorkflowRun( owner: string, repo: string, runId: number ) { owner = validateOwnerName(owner); repo = validateRepositoryName(repo); const url = `https://api.github.com/repos/${owner}/${repo}/actions/runs/${runId}/rerun`; await githubRequest(url, { method: 'POST' }); // This endpoint doesn't return any data on success return { success: true, message: `Workflow run ${runId} restarted` }; } - src/operations/actions.ts:77-84 (schema)Defines the Zod input schema for the tool (reused from cancel workflow run schema) with fields for owner, repo, and runId. RerunWorkflowSchema is an alias to this schema.
export const CancelWorkflowRunSchema = z.object({ owner: z.string().describe("Repository owner (username or organization)"), repo: z.string().describe("Repository name"), runId: z.number().describe("The ID of the workflow run"), }); // Rerun workflow schema export const RerunWorkflowSchema = CancelWorkflowRunSchema; - src/index.ts:225-232 (registration)Registers the "rerun_workflow" tool with the MCP server using the defined schema and a thin wrapper handler that calls the core rerunWorkflowRun function.
server.tool( "rerun_workflow", actions.RerunWorkflowSchema.shape, async (request: any) => { const result = await actions.rerunWorkflowRun(request.owner, request.repo, request.runId); return { content: [{ type: "text", text: JSON.stringify(result) }] }; } );