fix(mcp): implement documented issue title/body editing capability #781

Closed
opened 2026-07-21 14:10:54 -05:00 by jcwalker3 · 1 comment
Owner

Problem

The gitea-workflow skill documents a gitea_edit_issue tool for editing issues, but no such tool is registered on the MCP server. There is currently no sanctioned MCP path to change an issue's title or body.

Evidence at master df3167488c5451f802549b40463ad59cbaad6109:

  • gitea_edit_issue is absent from every namespace (gitea-tools, gitea-reviewer, gitea-merger, gitea-reconciler).
  • The registered issue-write tools in gitea_mcp_server.py are gitea_create_issue, gitea_lock_issue, gitea_close_issue, gitea_create_issue_comment, gitea_mark_issue, gitea_reconcile_issue_claims, and gitea_set_issue_labels. None edits a title or body.
  • The only edit tool is gitea_edit_pr, which PATCHes the pull-request endpoint and cannot target an issue.
  • The server issues no PATCH request to the issues endpoint anywhere in the codebase.

Consequence: a required body correction on Issue #780 could not be performed through the sanctioned workflow. The relationship had to be recorded as a discussion comment instead, and any real body edit would require the web UI or a forbidden CLI/direct-API substitute.

Documentation and the registered tool inventory have drifted, so an actor can plan a mutation against a tool that does not exist and only discover it at execution time.

Expected behavior

Provide a sanctioned author-role gitea_edit_issue tool that:

  1. Edits an issue title, body, or both in a single call.
  2. Performs the mutation via PATCH /issues/{number} through the MCP server.
  3. Preserves every field the caller did not specify, including labels, state, assignee, and milestone.
  4. Enforces the standard gates: identity verification, profile/permission check, repository binding, branches/ worktree validation, capability-stamp consumption, and audit logging.
  5. Performs read-after-write verification and fails closed if the resulting title/body does not match what was requested.
  6. Rejects no-op and invalid requests with actionable diagnostics rather than silent success.

Scope

  • Register the tool in the MCP server with the same preflight and anti-stomp treatment as other issue mutations.
  • Route it through the existing capability map with an explicit resolver task.
  • Do not expand gitea_edit_pr to accept issue numbers; issue and pull-request edit paths must stay separate.
  • Update the gitea-workflow documentation so the documented tool inventory matches the registered inventory, and add a check that prevents the two from drifting again.

Acceptance criteria

  • A sanctioned author-role gitea_edit_issue tool exists and is reachable from the gitea-tools namespace.
  • Title-only, body-only, and combined edits all succeed.
  • Unspecified fields are provably unchanged after an edit.
  • Identity, profile, repository-binding, worktree, capability-stamp, and audit gates all apply and fail closed.
  • Read-after-write verification confirms the applied content.
  • gitea_edit_pr remains pull-request-only.
  • Documentation lists exactly the tools that are registered, with a guard against future drift.
  • Tests cover: title-only edit, body-only edit, combined edit, no-op request, invalid request, authorization failure, preservation of labels and state, read-after-write mismatch, and transport error handling.

Evidence

Discovered while attempting an authorized body update on Issue #780. The tool lookup returned no match in any namespace, and a source inventory confirmed no issue title/body edit path exists. The relationship was recorded as a comment on #780 as the sanctioned fallback; no CLI, curl, direct API, raw Git, or database access was used.

## Problem The `gitea-workflow` skill documents a `gitea_edit_issue` tool for editing issues, but no such tool is registered on the MCP server. There is currently no sanctioned MCP path to change an issue's title or body. Evidence at master `df3167488c5451f802549b40463ad59cbaad6109`: - `gitea_edit_issue` is absent from every namespace (`gitea-tools`, `gitea-reviewer`, `gitea-merger`, `gitea-reconciler`). - The registered issue-write tools in `gitea_mcp_server.py` are `gitea_create_issue`, `gitea_lock_issue`, `gitea_close_issue`, `gitea_create_issue_comment`, `gitea_mark_issue`, `gitea_reconcile_issue_claims`, and `gitea_set_issue_labels`. None edits a title or body. - The only edit tool is `gitea_edit_pr`, which PATCHes the pull-request endpoint and cannot target an issue. - The server issues no `PATCH` request to the issues endpoint anywhere in the codebase. Consequence: a required body correction on Issue #780 could not be performed through the sanctioned workflow. The relationship had to be recorded as a discussion comment instead, and any real body edit would require the web UI or a forbidden CLI/direct-API substitute. Documentation and the registered tool inventory have drifted, so an actor can plan a mutation against a tool that does not exist and only discover it at execution time. ## Expected behavior Provide a sanctioned author-role `gitea_edit_issue` tool that: 1. Edits an issue title, body, or both in a single call. 2. Performs the mutation via `PATCH /issues/{number}` through the MCP server. 3. Preserves every field the caller did not specify, including labels, state, assignee, and milestone. 4. Enforces the standard gates: identity verification, profile/permission check, repository binding, `branches/` worktree validation, capability-stamp consumption, and audit logging. 5. Performs read-after-write verification and fails closed if the resulting title/body does not match what was requested. 6. Rejects no-op and invalid requests with actionable diagnostics rather than silent success. ## Scope - Register the tool in the MCP server with the same preflight and anti-stomp treatment as other issue mutations. - Route it through the existing capability map with an explicit resolver task. - Do **not** expand `gitea_edit_pr` to accept issue numbers; issue and pull-request edit paths must stay separate. - Update the `gitea-workflow` documentation so the documented tool inventory matches the registered inventory, and add a check that prevents the two from drifting again. ## Acceptance criteria - A sanctioned author-role `gitea_edit_issue` tool exists and is reachable from the `gitea-tools` namespace. - Title-only, body-only, and combined edits all succeed. - Unspecified fields are provably unchanged after an edit. - Identity, profile, repository-binding, worktree, capability-stamp, and audit gates all apply and fail closed. - Read-after-write verification confirms the applied content. - `gitea_edit_pr` remains pull-request-only. - Documentation lists exactly the tools that are registered, with a guard against future drift. - Tests cover: title-only edit, body-only edit, combined edit, no-op request, invalid request, authorization failure, preservation of labels and state, read-after-write mismatch, and transport error handling. ## Evidence Discovered while attempting an authorized body update on Issue #780. The tool lookup returned no match in any namespace, and a source inventory confirmed no issue title/body edit path exists. The relationship was recorded as a comment on #780 as the sanctioned fallback; no CLI, curl, direct API, raw Git, or database access was used.
jcwalker3 added the mcpstatus:readyworkflow-hardeningtype:bug labels 2026-07-21 14:10:54 -05:00
jcwalker3 added status:in-progress and removed status:ready labels 2026-07-21 15:34:12 -05:00
Author
Owner

Issue claim heartbeat

<!-- gitea-issue-claim-heartbeat:v1 --> **Issue claim heartbeat** - kind: claim - issue: #781 - branch: fix/issue-781-mcp-edit-issue-tool - phase: claimed - profile: prgs-author - pr: none - blocker: none - next_action: create worktree and begin implementation
jcwalker3 added status:pr-open and removed status:in-progress labels 2026-07-21 15:53:15 -05:00
sysadmin removed the status:pr-open label 2026-07-21 16:15:04 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Scaled-Tech-Consulting/Gitea-Tools#781