Skip to main content
Glama

Set pull request draft state at exact head

gh_set_pr_draft_state
Destructive

Transition a pull request between draft and ready-for-review states, verifying the current head SHA and draft status to avoid unintended modifications.

Instructions

Destructive write: transition exactly one pull request between draft and ready-for-review only when its current head SHA and draft state match the supplied preconditions. The operation changes no unrelated pull-request metadata, is attempted once, and authoritative readback verifies both unchanged head identity and the requested draft state.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoYesGitHub repository name without the owner prefix.
ownerYesGitHub repository owner or organization login.
numberYesPull request number to transition.
new_is_draftYesRequested draft state after mutation.
expected_head_shaYesExact current pull-request head SHA required before mutation.
expected_is_draftYesExact current draft state required before mutation.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
numberYes
warningNo
request_idNo
write_completedYes
current_head_shaNo
current_is_draftNo
previous_head_shaYes
previous_is_draftYes
readback_completedYes
precondition_checkedYes
state_matches_requestedYes
Behavior5/5

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

Annotations already mark it as destructive and non-idempotent, but the description adds critical context: it changes no unrelated metadata, is attempted once, and reads back authoritatively to verify head identity and draft state. This goes beyond the annotation flags and provides a clear safety contract.

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?

Two dense sentences with no filler. The opening 'Destructive write' immediately sets expectations, and every clause adds meaning about scope, preconditions, and verification.

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?

Given the tool's complexity—conditional mutation with 6 required parameters and a destructive action—the description covers the essential aspects: what it does, under what conditions, what it doesn't touch, and how it verifies success. The existence of an output schema means return-value details are not needed in the description.

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

Parameters4/5

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

The input schema has 100% parameter coverage, so the baseline is 3. The description adds semantic value by framing expected_head_sha and expected_is_draft as 'preconditions' and new_is_draft as the 'requested state', clarifying how the parameters interact in the mutation.

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 a specific action: 'transition exactly one pull request between draft and ready-for-review' with explicit conditions. It differentiates from siblings like gh_edit_pr by emphasizing the exact-head precondition and the targeted scope.

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 description implies when to use the tool: when a conditional, precise draft-state transition is needed with preconditions on head SHA and current draft state. It doesn't explicitly name alternatives or exclusions, but the context is clear enough for a capable agent to select it appropriately.

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/fvanevski/gh_mcp'

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