feat: complete label management (name->id resolution, update/remove)

Resolves the long-standing problem that label tools passed names while Gitea's
API requires numeric label ids.

- gitea_client: add _resolve_label_ids() helper; create_issue and add_labels now
  resolve label names to ids (case-insensitive) and raise a clear "Unknown
  label(s)" error instead of a generic 500.
- New tools: remove_labels (by name) and update_label (located by current name).
- Register both write tools and document the name-based label contract.
- Tests: resolver mapping + unknown-label error, add_labels id translation,
  update_label and remove_labels handlers.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
LatteandClaude Opus 4.8 committed 2026-06-14 20:34:35 +02:00
1 parent f0db219ee8
commit c282ffe359
8 files changed
+306 -11

No files matched your search

+4
View File
@@ -85,7 +85,9 @@ from aegis_gitea_mcp.tools.write_tools import (
create_issue_tool,
create_label_tool,
create_pr_comment_tool,
remove_labels_tool,
update_issue_tool,
update_label_tool,
)
logger = logging.getLogger(__name__)
@@ -344,6 +346,8 @@ TOOL_HANDLERS: dict[str, ToolHandler] = {
"add_labels": add_labels_tool,
"assign_issue": assign_issue_tool,
"create_label": create_label_tool,
"update_label": update_label_tool,
"remove_labels": remove_labels_tool,
}