Skip to main content
Glama

get_pull_request_status

Determine the status (open, closed, merged) of a pull request by providing the repository owner, name, and pull number.

Instructions

Get the status of a specific pull request.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
ownerYesRepository owner
repoYesRepository name
pullNumberYesPull request number

Implementation Reference

  • The main handler function for the 'get_pull_request_status' tool. It fetches the pull request via octokit to get the head SHA, then calls getCombinedStatusForRef to retrieve the combined status. It formats the result as markdown with status check groups (failed, error, pending, passed).
    server.tool(
    	"get_pull_request_status",
    	"Get the status of a specific pull request.",
    	{
    		owner: z.string().describe("Repository owner"),
    		repo: z.string().describe("Repository name"),
    		pullNumber: z.number().describe("Pull request number"),
    	},
    	async ({ owner, repo, pullNumber }) => {
    		try {
    			// Get the PR to find the head SHA
    			const prResp = await octokit.rest.pulls.get({
    				owner,
    				repo,
    				pull_number: pullNumber,
    			})
    			const sha = prResp.data.head.sha
    			const statusResp = await octokit.rest.repos.getCombinedStatusForRef({
    				owner,
    				repo,
    				ref: sha,
    			})
    
    			const status = statusResp.data
    
    			// Format as clean markdown
    			let markdown = `# Pull Request #${pullNumber} Status\n\n`
    			markdown += `**Overall State:** ${status.state}\n`
    			markdown += `**SHA:** ${status.sha.substring(0, 7)}\n`
    			markdown += `**Total Checks:** ${status.total_count}\n\n`
    
    			if (status.statuses && status.statuses.length > 0) {
    				markdown += `## Status Checks\n\n`
    
    				// Group statuses by state
    				const grouped = {
    					success: status.statuses.filter(s => s.state === "success"),
    					failure: status.statuses.filter(s => s.state === "failure"),
    					error: status.statuses.filter(s => s.state === "error"),
    					pending: status.statuses.filter(s => s.state === "pending"),
    				}
    
    				// Show failures and errors first
    				if (grouped.failure.length > 0) {
    					markdown += `### Failed\n\n`
    					grouped.failure.forEach(check => {
    						markdown += `- **${check.context}**: ${check.description || "No description"}\n`
    						if (check.target_url) {
    							markdown += `  - [View Details](${check.target_url})\n`
    						}
    					})
    					markdown += `\n`
    				}
    
    				if (grouped.error.length > 0) {
    					markdown += `### Errors\n\n`
    					grouped.error.forEach(check => {
    						markdown += `- **${check.context}**: ${check.description || "No description"}\n`
    						if (check.target_url) {
    							markdown += `  - [View Details](${check.target_url})\n`
    						}
    					})
    					markdown += `\n`
    				}
    
    				if (grouped.pending.length > 0) {
    					markdown += `### Pending\n\n`
    					grouped.pending.forEach(check => {
    						markdown += `- **${check.context}**: ${check.description || "No description"}\n`
    						if (check.target_url) {
    							markdown += `  - [View Details](${check.target_url})\n`
    						}
    					})
    					markdown += `\n`
    				}
    
    				if (grouped.success.length > 0) {
    					markdown += `### Passed\n\n`
    					grouped.success.forEach(check => {
    						markdown += `- **${check.context}**: ${check.description || "No description"}\n`
    					})
    					markdown += `\n`
    				}
    			} else {
    				markdown += `*No status checks found*\n`
    			}
    
    			return {
    				content: [{ type: "text", text: markdown }],
    			}
    		} catch (e: any) {
    			return {
    				content: [{ type: "text", text: `Error: ${e.message}` }],
    			}
    		}
    	},
    )
  • Input schema for the tool, defining required parameters: owner (string), repo (string), and pullNumber (number) using Zod validation.
    {
    	owner: z.string().describe("Repository owner"),
    	repo: z.string().describe("Repository name"),
    	pullNumber: z.number().describe("Pull request number"),
    },
  • Registration of the tool via server.tool() with the name 'get_pull_request_status' and description 'Get the status of a specific pull request.'
    server.tool(
    	"get_pull_request_status",
  • src/index.ts:18-18 (registration)
    The call to registerPullRequestTools(server, octokit) which registers all pull request tools including get_pull_request_status.
    registerPullRequestTools(server, octokit)
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, and the description does not disclose any behavioral traits such as whether it is read-only, authorization requirements, or what the response format is, leaving the agent without important context.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, concise sentence that efficiently conveys the tool's purpose without extraneous information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the lack of output schema and annotations, the description should provide more context about what 'status' entails or the expected response, but it does not.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema provides complete descriptions for all three parameters (owner, repo, pullNumber), and the description adds no additional meaning beyond the schema, achieving a baseline score.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Get') and the resource ('status of a specific pull request'), differentiating it from sibling tools that retrieve other aspects of pull requests.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided on when to use this tool versus alternatives like get_pull_request or get_pull_request_comments, nor are there any conditions or prerequisites mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hithereiamaliff/mcp-github'

If you have feedback or need assistance with the MCP directory API, please join our Discord server