Skip to main content
Glama

Close a GitHub pull request

github_pr_close
DestructiveIdempotent

Close a GitHub pull request without merging it or deleting its branch. Optionally post a comment as it closes; already closed or merged pull requests are left unchanged.

Instructions

Close a pull request without merging it; its branch is not deleted. The comment, if any, is posted as it closes, and the people following the pull request are notified. A pull request that is closed or merged already is left as it is: nothing is sent, the comment is not posted, changed is false and state says which. A pull request is 12, #12, owner/repo#12 or its URL; a bare number means the working tree's repository, or repo.

Input Schema

NameRequiredDescriptionDefault
prYesThe pull request, as 12, #12, owner/repo#12 or its URL.
repoNoowner/name; defaults to the working tree's repository (its origin). Used for a bare number.
commentNoA comment to post as the pull request closes.

Output Schema

NameRequiredDescriptionDefault
prYes
urlYes
repoYes
stateYesclosed, or merged for a pull request that was merged already.
changedYesFalse when the pull request was closed or merged already and nothing was sent.
foreignYes

Schema Changelog

Changes observed during successful MCP inspections.

  1. Addedv0.7.0

TDQS

A4.4/5.0
Behavior5/5

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

Annotations already declare destructiveHint=true and idempotentHint=true, so the bar is lower, yet the description still adds real behavior: the branch survives, the comment is posted as part of the close, watchers are notified, and on an already-closed/merged PR nothing is sent and the result reports changed=false with a state field. That last clause is exactly the kind of idempotency detail an agent needs to interpret the response.

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

Conciseness4/5

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

Front-loaded with the core action and its key constraint, then the side effects, then the no-op case. The final sentence largely repeats the pr and repo parameter descriptions, which is the one piece of wasted text in an otherwise dense, well-ordered definition.

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

Completeness5/5

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

For a three-parameter mutation with an output schema, this covers everything an agent needs: what changes, what does not (branch), the notification and comment side effects, and the no-op outcome. Return-value detail is correctly left to the output schema, with just enough of the result shape referenced to make the idempotent path interpretable.

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?

Schema description coverage is 100%, so all three parameters are already documented. The description's restatement of the pr formats ("12, #12, owner/repo#12 or its URL") and the bare-number/repo fallback duplicates the schema text almost verbatim rather than adding new meaning. Baseline 3 applies when the schema does the heavy lifting.

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?

States a specific verb and resource ("Close a pull request") and immediately scopes it against the obvious sibling: "without merging it; its branch is not deleted." That single clause separates it from github_pr_merge and github_pr_reopen without the agent needing to open either schema.

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

Usage Guidelines4/5

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

The merge exclusion tells the agent when not to use this tool, and the already-closed/merged clause tells it the call is safe to attempt regardless of current state. It stops short of explicitly routing to github_pr_reopen or github_pr_merge by name, so the alternative selection is implied rather than spelled out.

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