get_commit_statuses
Fetch commit statuses for a specific repository, owner, and reference to track build, test, or deployment states directly from GitHub.
Instructions
Get statuses for a commit
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner (username or organization) | |
| ref | Yes | The ref (SHA, branch name, or tag name) to get statuses for | |
| repo | Yes | Repository name |
Implementation Reference
- src/operations/statuses.ts:81-92 (handler)The core handler function that fetches the list of commit statuses from the GitHub API for a given repository and ref (SHA, branch, or tag). It uses githubRequest utility and parses the response with 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-38 (schema)Zod schema defining the public input parameters for the get_commit_statuses tool: owner, repo, ref.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") });
- src/operations/statuses.ts:40-42 (schema)Extended internal Zod schema that adds the required github_pat parameter for parsing tool arguments.export const _GetCommitStatusesSchema = GetCommitStatusesSchema.extend({ github_pat: z.string().describe("GitHub Personal Access Token"), });
- src/index.ts:216-220 (registration)Tool registration in the listTools response, defining name, description, and input schema (converted to JSON schema).{ name: "get_commit_statuses", description: "Get statuses for a commit", inputSchema: zodToJsonSchema(statuses.GetCommitStatusesSchema), },
- src/index.ts:629-636 (registration)Dispatch handler in the main switch statement for CallToolRequest that parses arguments with the extended schema and calls the core 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) }], }; }