get_workflow_usage
Retrieve GitHub Actions workflow usage statistics to monitor execution time and billing metrics for specific repositories.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner (username or organization) | |
| repo | Yes | Repository name | |
| workflowId | Yes | The ID of the workflow or filename (string or number) |
Implementation Reference
- src/operations/actions.ts:124-135 (handler)The main handler function that fetches workflow usage/timing data from the GitHub API /actions/workflows/{workflowId}/timing endpoint, validates inputs, and parses the response using WorkflowUsageSchema.export async function getWorkflowUsage( owner: string, repo: string, workflowId: string | number ) { owner = validateOwnerName(owner); repo = validateRepositoryName(repo); const url = `https://api.github.com/repos/${owner}/${repo}/actions/workflows/${workflowId}/timing`; const response = await githubRequest(url); return WorkflowUsageSchema.parse(response); }
- src/index.ts:168-175 (registration)Registers the MCP tool 'get_workflow_usage' with the server, providing the input schema and handler invocation that returns JSON stringified result.server.tool( "get_workflow_usage", actions.GetWorkflowUsageSchema.shape, async (request: any) => { const result = await actions.getWorkflowUsage(request.owner, request.repo, request.workflowId); return { content: [{ type: "text", text: JSON.stringify(result) }] }; } );
- src/operations/actions.ts:25-32 (schema)Defines the input schema for get_workflow_usage (GetWorkflowUsageSchema aliases GetWorkflowSchema) using Zod for validation of owner, repo, and workflowId parameters.export const GetWorkflowSchema = z.object({ owner: z.string().describe("Repository owner (username or organization)"), repo: z.string().describe("Repository name"), workflowId: z.string().describe("The ID of the workflow or filename (string or number)"), }); // Get workflow usage schema export const GetWorkflowUsageSchema = GetWorkflowSchema;