feat: add update_issue MCP tool #25

Merged
forgejo_admin merged 1 commit from 15-add-update-issue-tool into main 2026-03-27 21:48:48 +00:00
Contributor

Summary

Adds update_issue MCP tool wrapping the SDK's issue_edit_issue method. Closes the dogfooding gap discovered during incident response (claude-custom#160) where updating issue titles/bodies required raw curl PATCH.

Changes

  • src/forgejo_mcp/tools/workflows.py: Added update_issue tool with params owner, repo, issue_number, optional title, optional body. Validates at least one field is provided before calling the SDK. Follows the create_issue pattern exactly (same decorator style, error handling, return shape).
  • tests/test_update_issue.py: 4 integration tests using @requires_forgejo pattern -- update body only, update title only, update both, and validation error when neither provided. Each test creates a disposable issue and closes it in cleanup.

Test Plan

  • All 16 tests pass (4 new + 12 existing): pytest tests/ -v
  • Integration tests verified against live Forgejo instance
  • ruff format and ruff check pass clean
  • No regressions in existing tools

Review Checklist

  • Passed automated review-fix loop
  • No secrets committed
  • No unnecessary file changes
  • Commit messages are descriptive
  • Closes #15
  • claude-custom#160 -- incident that exposed the dogfooding gap
  • project-pal-e-agency -- enforcement architecture
## Summary Adds `update_issue` MCP tool wrapping the SDK's `issue_edit_issue` method. Closes the dogfooding gap discovered during incident response (claude-custom#160) where updating issue titles/bodies required raw `curl PATCH`. ## Changes - `src/forgejo_mcp/tools/workflows.py`: Added `update_issue` tool with params `owner`, `repo`, `issue_number`, optional `title`, optional `body`. Validates at least one field is provided before calling the SDK. Follows the `create_issue` pattern exactly (same decorator style, error handling, return shape). - `tests/test_update_issue.py`: 4 integration tests using `@requires_forgejo` pattern -- update body only, update title only, update both, and validation error when neither provided. Each test creates a disposable issue and closes it in cleanup. ## Test Plan - [x] All 16 tests pass (4 new + 12 existing): `pytest tests/ -v` - [x] Integration tests verified against live Forgejo instance - [x] `ruff format` and `ruff check` pass clean - [x] No regressions in existing tools ## Review Checklist - [x] Passed automated review-fix loop - [x] No secrets committed - [x] No unnecessary file changes - [x] Commit messages are descriptive ## Related Notes - Closes #15 - `claude-custom#160` -- incident that exposed the dogfooding gap - `project-pal-e-agency` -- enforcement architecture
feat: add update_issue MCP tool wrapping SDK issue_edit_issue
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
302a3a7b63
Exposes title and body updates on Forgejo issues via MCP, closing the
dogfooding gap that forced raw curl PATCH during incident response.

Includes 4 integration tests: update body, update title, update both,
and validation that at least one field is required.

Closes #15

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Author
Contributor

QA Review -- PR #25

Tool Implementation (workflows.py, +31 lines)

  • Follows create_issue pattern exactly: same @mcp.tool() decorator, Annotated[..., Field(...)] params, json.dumps return, _error_response(exc) catch-all.
  • Params match acceptance criteria: owner, repo, issue_number, optional title, optional body.
  • Validation correct: returns error JSON when both title and body are None.
  • Return shape (number, url, title) matches "returns updated issue number and URL" criterion.
  • Placement after create_issue and before create_issue_and_branch is logical.

Tests (test_update_issue.py, +114 lines)

  • Uses @requires_forgejo integration pattern (not unit tests). Correct per issue spec.
  • 4 tests cover all acceptance criteria: body-only, title-only, both, no-fields-error.
  • Each test creates a disposable issue, updates, verifies via SDK read-back (issue_get_issue), cleans up in finally.
  • The no-fields test correctly skips forgejo_client fixture since it short-circuits before API calls.

SOP Compliance

  • No secrets committed
  • No unrelated file changes (2 files, both on-target)
  • ruff format and ruff check pass
  • All 16 tests pass (4 new + 12 existing)
  • PR body follows template with all required sections
  • Closes #15 present for auto-close

Nits

None.

VERDICT: APPROVE -- Clean, minimal implementation. No fixes needed.

## QA Review -- PR #25 ### Tool Implementation (`workflows.py`, +31 lines) - Follows `create_issue` pattern exactly: same `@mcp.tool()` decorator, `Annotated[..., Field(...)]` params, `json.dumps` return, `_error_response(exc)` catch-all. - Params match acceptance criteria: `owner`, `repo`, `issue_number`, optional `title`, optional `body`. - Validation correct: returns error JSON when both `title` and `body` are `None`. - Return shape (`number`, `url`, `title`) matches "returns updated issue number and URL" criterion. - Placement after `create_issue` and before `create_issue_and_branch` is logical. ### Tests (`test_update_issue.py`, +114 lines) - Uses `@requires_forgejo` integration pattern (not unit tests). Correct per issue spec. - 4 tests cover all acceptance criteria: body-only, title-only, both, no-fields-error. - Each test creates a disposable issue, updates, verifies via SDK read-back (`issue_get_issue`), cleans up in `finally`. - The no-fields test correctly skips `forgejo_client` fixture since it short-circuits before API calls. ### SOP Compliance - [x] No secrets committed - [x] No unrelated file changes (2 files, both on-target) - [x] `ruff format` and `ruff check` pass - [x] All 16 tests pass (4 new + 12 existing) - [x] PR body follows template with all required sections - [x] `Closes #15` present for auto-close ### Nits None. **VERDICT: APPROVE** -- Clean, minimal implementation. No fixes needed.
forgejo_admin deleted branch 15-add-update-issue-tool 2026-03-27 21:48:48 +00:00
Sign in to join this conversation.
No description provided.