Add delete_issue tool #21

Open
opened 2026-04-28 14:17:20 +00:00 by jbr870 · 0 comments
Owner

Summary

Add a delete_issue tool that wraps DELETE /repos/{owner}/{repo}/issues/{index}.

Background

The Forgejo API exposes an issueDelete endpoint (visible in the swagger at /api/swagger/#/issue/issueDelete), but the MCP server does not currently wrap it. Today the only way to remove a test issue is change_issue_state(state="closed"), which leaves the issue in the repo's history.

This came up while writing the regression test prompt: each run leaves a closed test issue (and its comment) behind, so after N runs the repo has N closed test issues. Not blocking — closure works fine for the regression to be re-runnable, since closed issues don't conflict — but a real delete_issue would let the test suite be properly idempotent.

Proposed signature

delete_issue(owner: str, repo: str, issue_index: int, instance: str | None = None) -> dict

Return shape: {"result": {"deleted": true, "issue_index": N}} on success, {"error": "..."} on failure (consistent with the rest of the server).

Caveats / docstring guidance

Issue deletion is destructive and irreversible. For normal workflows, change_issue_state(state="closed") is almost always the right primitive — GitHub, by comparison, doesn't expose delete-issue at all, for this reason. The docstring should make this clear so agents don't reach for delete_issue when they mean "close".

Primary use cases:

  • Cleaning up test artifacts (regression scripts, throwaway sandbox repos).
  • Removing accidentally-created spam or duplicate issues.
  • Companion: #(delete_comment issue, filed separately)
  • Caller of this gap: regression test prompt (currently has an idempotency caveat that this would resolve).
## Summary Add a `delete_issue` tool that wraps `DELETE /repos/{owner}/{repo}/issues/{index}`. ## Background The Forgejo API exposes an `issueDelete` endpoint (visible in the swagger at `/api/swagger/#/issue/issueDelete`), but the MCP server does not currently wrap it. Today the only way to remove a test issue is `change_issue_state(state="closed")`, which leaves the issue in the repo's history. This came up while writing the regression test prompt: each run leaves a closed test issue (and its comment) behind, so after N runs the repo has N closed test issues. Not blocking — closure works fine for the regression to be re-runnable, since closed issues don't conflict — but a real `delete_issue` would let the test suite be properly idempotent. ## Proposed signature ``` delete_issue(owner: str, repo: str, issue_index: int, instance: str | None = None) -> dict ``` Return shape: `{"result": {"deleted": true, "issue_index": N}}` on success, `{"error": "..."}` on failure (consistent with the rest of the server). ## Caveats / docstring guidance Issue deletion is destructive and irreversible. For normal workflows, `change_issue_state(state="closed")` is almost always the right primitive — GitHub, by comparison, doesn't expose delete-issue at all, for this reason. The docstring should make this clear so agents don't reach for `delete_issue` when they mean "close". Primary use cases: - Cleaning up test artifacts (regression scripts, throwaway sandbox repos). - Removing accidentally-created spam or duplicate issues. ## Related - Companion: #(delete_comment issue, filed separately) - Caller of this gap: regression test prompt (currently has an idempotency caveat that this would resolve).
Sign in to join this conversation.
No labels
status/paused
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jbr870/forgejo-mcp-server#21
No description provided.