get-pull-request-status
Retrieve the combined status of all checks for a GitHub pull request to verify if it's ready for merge by providing repository owner, name, and PR number.
Instructions
Get the combined status of all status checks for a pull request
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner (username or organization) | |
| pull_number | Yes | Pull request number | |
| repo | Yes | Repository name |
Implementation Reference
- src/tools/pull-requests.ts:297-337 (handler)The primary handler function for the 'get-pull-request-status' tool. It validates input using GetPullRequestStatusSchema, fetches the PR head SHA, and retrieves combined status checks from GitHub API.export async function getPullRequestStatus(args: unknown): Promise<any> { const { owner, repo, pull_number } = GetPullRequestStatusSchema.parse(args); const github = getGitHubApi(); return tryCatchAsync(async () => { // First get the pull request to get the head SHA const { data: pr } = await github.getOctokit().pulls.get({ owner, repo, pull_number, }); // Then get the combined status for the head SHA const { data } = await github.getOctokit().repos.getCombinedStatusForRef({ owner, repo, ref: pr.head.sha, }); return { state: data.state, statuses: data.statuses.map((status) => ({ context: status.context, state: status.state, description: status.description, target_url: status.target_url, created_at: status.created_at, updated_at: status.updated_at, })), sha: data.sha, total_count: data.total_count, repository: { name: data.repository.name, full_name: data.repository.full_name, owner: { login: data.repository.owner.login, }, }, }; }, 'Failed to get pull request status'); }
- src/utils/validation.ts:165-167 (schema)Zod schema for runtime input validation of the getPullRequestStatus tool parameters.export const GetPullRequestStatusSchema = OwnerRepoSchema.extend({ pull_number: z.number().int().positive(), });
- src/server.ts:927-949 (registration)Tool registration in the ListTools response, including name, description, and MCP input schema.{ name: 'get-pull-request-status', description: 'Get the combined status of all status checks for a pull request', inputSchema: { type: 'object', properties: { owner: { type: 'string', description: 'Repository owner (username or organization)', }, repo: { type: 'string', description: 'Repository name', }, pull_number: { type: 'number', description: 'Pull request number', }, }, required: ['owner', 'repo', 'pull_number'], additionalProperties: false, }, },
- src/server.ts:1241-1243 (registration)Dispatcher case in the CallToolRequestHandler switch statement that invokes the getPullRequestStatus handler.case 'get-pull-request-status': result = await getPullRequestStatus(parsedArgs); break;
- src/server.ts:48-52 (registration)Import statement for the getPullRequestStatus function from the pull-requests module.getPullRequestStatus, updatePullRequestBranch, getPullRequestComments, getPullRequestReviews, } from './tools/pull-requests.js';