feat: add set_label, comment_on_issue, and create_repo MCP tools #10

Merged
forgejo_admin merged 1 commit from 6-add-set-label-comment-on-issue-create-repo into main 2026-03-13 20:19:52 +00:00
Contributor

Summary

Add three new MCP tools to workflows.py that unblock the agent workflow state machine: set_label (resolves label names to IDs, supports add/replace modes), comment_on_issue (posts markdown comments), and create_repo (handles user and org repo creation with auto-init).

Changes

  • src/forgejo_mcp/tools/workflows.py -- Added set_label, comment_on_issue, and create_repo tool functions following existing @mcp.tool() pattern with Annotated params, JSON return, and _error_response() error handling
  • tests/test_new_tools.py -- Added 6 integration tests: set_label add mode, replace mode, missing label error, invalid mode error; comment_on_issue create+verify; create_repo create+verify+cleanup

Test Plan

  • All 8 tests pass: pytest tests/ -v (6 new + 2 existing)
  • ruff check and ruff format both clean

Review Checklist

  • Code follows existing @mcp.tool() pattern in workflows.py
  • No new files or abstractions beyond what the issue specifies
  • set_label accepts names not IDs, resolves via issue_list_labels
  • set_label supports both add and replace modes (default: add)
  • comment_on_issue returns comment ID and body
  • create_repo handles both user and org owners
  • All tools use _error_response() for error handling
  • Integration tests clean up after themselves
  • ruff lint and format pass
  • Plan: plan-pal-e-agency (traceability)
  • Forgejo issue: #6

Closes #6

## Summary Add three new MCP tools to `workflows.py` that unblock the agent workflow state machine: `set_label` (resolves label names to IDs, supports add/replace modes), `comment_on_issue` (posts markdown comments), and `create_repo` (handles user and org repo creation with auto-init). ## Changes - `src/forgejo_mcp/tools/workflows.py` -- Added `set_label`, `comment_on_issue`, and `create_repo` tool functions following existing `@mcp.tool()` pattern with `Annotated` params, JSON return, and `_error_response()` error handling - `tests/test_new_tools.py` -- Added 6 integration tests: set_label add mode, replace mode, missing label error, invalid mode error; comment_on_issue create+verify; create_repo create+verify+cleanup ## Test Plan - All 8 tests pass: `pytest tests/ -v` (6 new + 2 existing) - `ruff check` and `ruff format` both clean ## Review Checklist - [x] Code follows existing `@mcp.tool()` pattern in workflows.py - [x] No new files or abstractions beyond what the issue specifies - [x] `set_label` accepts names not IDs, resolves via `issue_list_labels` - [x] `set_label` supports both add and replace modes (default: add) - [x] `comment_on_issue` returns comment ID and body - [x] `create_repo` handles both user and org owners - [x] All tools use `_error_response()` for error handling - [x] Integration tests clean up after themselves - [x] ruff lint and format pass ## Related - Plan: `plan-pal-e-agency` (traceability) - Forgejo issue: #6 Closes #6
feat: add set_label, comment_on_issue, and create_repo MCP tools
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/pr/woodpecker Pipeline was successful
d11c647100
Add three new MCP tools to workflows.py for the agent workflow state
machine. set_label resolves label names to IDs and supports add/replace
modes. comment_on_issue posts markdown comments on issues. create_repo
handles both user and org repo creation with auto-init.

Closes #6

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
forgejo_admin deleted branch 6-add-set-label-comment-on-issue-create-repo 2026-03-13 20:19:52 +00:00
Sign in to join this conversation.
No description provided.