get_commit_statuses
Retrieve GitHub commit statuses to check build results, test outcomes, and deployment states for specific repository references.
Instructions
Get statuses for a commit
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner (username or organization) | |
| repo | Yes | Repository name | |
| ref | Yes | The ref (SHA, branch name, or tag name) to get statuses for |
Implementation Reference
- src/operations/statuses.ts:81-92 (handler)The core handler function that fetches commit statuses from the GitHub API endpoint `/repos/{owner}/{repo}/commits/{ref}/statuses` and parses the response using Zod.export async function getCommitStatuses( github_pat: string, owner: string, repo: string, ref: string ): Promise<z.infer<typeof CommitStatusSchema>[]> { const response = await githubRequest( github_pat, `https://api.github.com/repos/${owner}/${repo}/commits/${ref}/statuses` ); return z.array(CommitStatusSchema).parse(response); }
- src/operations/statuses.ts:34-42 (schema)Zod input schemas: GetCommitStatusesSchema (public) and _GetCommitStatusesSchema (internal with github_pat) used for validation.export const GetCommitStatusesSchema = z.object({ owner: z.string().describe("Repository owner (username or organization)"), repo: z.string().describe("Repository name"), ref: z.string().describe("The ref (SHA, branch name, or tag name) to get statuses for") }); export const _GetCommitStatusesSchema = GetCommitStatusesSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
- src/index.ts:217-220 (registration)Tool registration in the listTools handler, defining name, description, and inputSchema.name: "get_commit_statuses", description: "Get statuses for a commit", inputSchema: zodToJsonSchema(statuses.GetCommitStatusesSchema), },
- src/index.ts:629-636 (registration)Dispatch handler in the CallToolRequest switch statement that validates arguments and invokes the getCommitStatuses function.case "get_commit_statuses": { const args = statuses._GetCommitStatusesSchema.parse(params.arguments); const { github_pat, owner, repo, ref } = args; const result = await statuses.getCommitStatuses(github_pat, owner, repo, ref); return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }], }; }