get_workflow_usage
Retrieve usage statistics for a specific GitHub Actions workflow by providing the repository owner, repository name, and workflow ID or filename.
Instructions
Get usage statistics of a workflow
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 |
Implementation Reference
- src/operations/actions.ts:124-135 (handler)The main handler function that implements the get_workflow_usage tool logic. It validates inputs, constructs the GitHub API URL for workflow timing statistics, fetches the data, and parses it 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/operations/actions.ts:32-32 (schema)Input schema definition for the get_workflow_usage tool, which reuses the GetWorkflowSchema defining required parameters: owner, repo, and workflowId.export const GetWorkflowUsageSchema = GetWorkflowSchema;
- src/index.ts:168-175 (registration)Registration of the get_workflow_usage tool in the MCP server using server.tool(), providing the input schema and the handler that calls the actions.getWorkflowUsage function.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) }] }; } );