Skip to main content
Glama

Set issue state with exact precondition

gh_set_issue_state
Destructive

Close or reopen a GitHub issue only if its current state matches the expected state; verifies final state and reason after the transition.

Instructions

Destructive write: close or reopen exactly one issue only when its current state matches expected_state. Pull requests are rejected. Closing requires completed, not_planned, or duplicate; reopening requires reopened. The mutation is attempted once, comments remain a separate tool, and authoritative readback verifies the final state and reason.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
repoYesGitHub repository name without the owner prefix.
ownerYesGitHub repository owner or organization login.
numberYesIssue number to transition.
new_stateYesRequested state after the transition.
state_reasonYesReason compatible with the requested issue state.
expected_stateYesExact current issue state required before mutation.

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
urlYes
numberYes
warningNo
closed_atNo
new_stateNo
request_idNo
reopened_atNoGitHub updated_at timestamp associated with a verified reopen transition. A confirmed mutation response is preferred; authoritative readback is the fallback because GitHub issue objects expose no dedicated reopened_at field.
state_reasonNo
previous_stateYes
write_completedYes
readback_completedYes
precondition_checkedYes
state_matches_requestedYes
Behavior5/5

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

While annotations already mark destructiveHint=true and readOnlyHint=false, the description adds crucial details: 'exactly one issue' (scope), 'only when current state matches' (precondition), 'Pull requests are rejected' (limitation), 'mutation is attempted once' (retry behavior), and 'authoritative readback verifies the final state' (post-action verification). These exceed annotation coverage and provide behavioral expectations not captured elsewhere.

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?

Four dense sentences, each adding distinct information: action+precondition, PR exclusion, reason logic, and post-verification. No filler or repetition. The opening phrase 'Destructive write' immediately signals risk, and every sentence earns its place.

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?

The tool has 6 required params and conditional logic, but the description covers the core behavioral contract: state transition, precondition, reason constraints, single attempt, readback verification, and separation from comments. An output schema exists, so return format needn't be described. Rate limits and auth are likely common across tools and not necessary. This is complete for its complexity.

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?

Schema coverage is 100% with descriptions for all parameters, so baseline is 3. The description adds value by mapping state_reason to new_state (closing requires completed/not_planned/duplicate; reopening requires reopened), which the schema only vaguely states as 'compatible'. It also clarifies that number refers to exactly one issue. This supplemental logic improves parameter understanding beyond schema.

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: 'close or reopen exactly one issue' with a specific precondition (expected_state match). It distinguishes from sibling tools like gh_edit_issue (which edits fields) and gh_create_issue by focusing on state transitions. The phrase 'Pull requests are rejected' further differentiates from PR manipulation tools.

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 gives clear context: use only when the issue's current state matches expected_state, and explicitly excludes PRs and comments ('comments remain a separate tool'). It doesn't explicitly name alternatives but implies when to use this over generic edit tools. The precondition and reason restrictions provide strong usage boundaries.

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