feat: issue_close and issue_reopen tools #30

Closed
opened 2026-05-18 05:11:38 +00:00 by mathias · 0 comments
Owner

Summary

Add issue_close and issue_reopen tools to allow agents to change issue state programmatically — closing completed issues and reopening them if needed.

Gitea API

PATCH /api/v1/repos/{owner}/{repo}/issues/{index}
Body: {"state": "closed"} or {"state": "open"}

Tool spec

tool: issue_close
params:
  owner:  string
  name:   string   // repo name
  number: integer  // issue number >= 1

tool: issue_reopen  
params:
  owner:  string
  name:   string
  number: integer

Returns

{
  "number": 26,
  "state": "closed",
  "title": "feat: expose ntfy via NPM...",
  "html_url": "..."
}

Required token permission

write:issue scope on the Gitea API token.

Risk classification

issue_close: LOW — reversible via issue_reopen.
issue_reopen: LOW — reversible.

Implementation notes

  • Both tools use the same PATCH endpoint with different state values
  • Consider a single issue_set_state tool with a state enum param instead of two tools — cleaner API, same implementation cost
  • Follow pattern of issue_get.go for struct and Call() layout
  • Test cases: close open issue, reopen closed issue, issue not found (404), allowlist rejection

Motivation

Discovered 2026-05-14: after completing infra issue #26 (ntfy via NPM), could not
close it programmatically from claude.ai. Had to leave it open or close manually
in web UI. Agents should be able to close issues as part of task completion flow —
e.g. after merging a PR that resolves an issue.

  • Pairs with issue_get (#20) — read state before changing it
  • Part of gitea-mcp v0.3 batch
## Summary Add `issue_close` and `issue_reopen` tools to allow agents to change issue state programmatically — closing completed issues and reopening them if needed. ## Gitea API `PATCH /api/v1/repos/{owner}/{repo}/issues/{index}` Body: `{"state": "closed"}` or `{"state": "open"}` ## Tool spec ``` tool: issue_close params: owner: string name: string // repo name number: integer // issue number >= 1 tool: issue_reopen params: owner: string name: string number: integer ``` ## Returns ```json { "number": 26, "state": "closed", "title": "feat: expose ntfy via NPM...", "html_url": "..." } ``` ## Required token permission `write:issue` scope on the Gitea API token. ## Risk classification `issue_close`: **LOW** — reversible via issue_reopen. `issue_reopen`: **LOW** — reversible. ## Implementation notes - Both tools use the same PATCH endpoint with different state values - Consider a single `issue_set_state` tool with a `state` enum param instead of two tools — cleaner API, same implementation cost - Follow pattern of `issue_get.go` for struct and Call() layout - Test cases: close open issue, reopen closed issue, issue not found (404), allowlist rejection ## Motivation Discovered 2026-05-14: after completing infra issue #26 (ntfy via NPM), could not close it programmatically from claude.ai. Had to leave it open or close manually in web UI. Agents should be able to close issues as part of task completion flow — e.g. after merging a PR that resolves an issue. ## Related - Pairs with `issue_get` (#20) — read state before changing it - Part of gitea-mcp v0.3 batch
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/gitea-mcp#30