- Tick all 27 tasks.md checkboxes for label-crud change - Add 8 label CRUD tools to README tool table - Add 3 label resource templates to README Resources section - Add resource table to AGENTS.md listing all 12 registered templates - Tick Codeberg #190 acceptance-criteria checkboxes (naming note included) - Close beads issue forgejo-mcp-773
4.2 KiB
4.2 KiB
1. Shared helpers (label-crud)
- 1.1 Add a
colornormalisation helper: acceptrrggbb/#rrggbb(6-digit only), lowercase, prepend#, reject invalid hex with-32602(shared by repo + org tools). No 3-digit shorthand (upstream unverified — see Open Questions) - 1.2 Add an in-use-count helper: repo via SDK
ListRepoIssuesfiltered by label name (state=all,type=all), read total from the returned*Responsepagination (NOTX-Total-Count—DoJSONdiscards headers); org by iterating the token-visible org repos and summing — best-effort, MAY under-count, refusal message discloses the visibility limit
2. Repo-label CRUD tools (label-crud)
- 2.1 Implement
create_repo_label(owner, repo, name, color, description?)via SDKCreateLabel; return created label incl. numericid - 2.2 Implement
edit_repo_label(owner, repo, id, name?, color?, description?)via SDKEditLabel; send only supplied fields; reject empty edit with-32602 - 2.3 Implement
delete_repo_label(owner, repo, id, delete_mode?)via SDKDeleteLabel; refuse if in-use count> 0anddelete_mode != "force"(report count); surface upstream404 - 2.4 Implement
get_repo_label(owner, repo, id)via SDKGetRepoLabel; return single label - 2.5 Register the four repo tools from
operation/operation.go(issue domain by default per design D5) - 2.6 Unit tests: create happy path + missing-hash normalisation, invalid color reject, edit partial-field PATCH, edit empty reject, delete unused/success, delete in-use refused-with-count, delete in-use
delete_mode="force"success, delete + 404, get-one + 404
3. Org-label CRUD tools (label-crud, raw-HTTP DoJSON)
- 3.1 Add org-label
DoJSONcalls inpkg/forgejoagainst/orgs/{org}/labels[/{id}], mirroringfetchOrgLabels - 3.2 Implement
create_org_label(org, name, color, description?)andget_org_label(org, id) - 3.3 Implement
edit_org_label(org, id, name?, color?, description?)(PATCH, only supplied fields) anddelete_org_label(org, id, delete_mode?)(in-use guard via §1.2 org path) - 3.4 Register the four org tools from
operation/operation.go - 3.5 Unit tests: create + color normalisation, get-one, edit partial PATCH, delete in-use refused-with-count, delete
delete_mode="force"success, 404
4. Label resource-templates (mcp-resource-label)
- 4.1 Add
ParseLabel(repo single) and the org-labels-list parser tooperation/resource/parse.go: reject non-numeric id with-32602 - 4.2 Create
resources*.gowithRegisterLabelResources(s *server.MCPServer) - 4.3 Register
forgejo://repo/{owner}/{repo}/label/{id}→ singleapplication/jsonlabel block - 4.4 Register
forgejo://repo/{owner}/{repo}/labels{?page,limit}→ client-controlledpage/limitbound,operation/resource.Bounded+EmbeddedListCapas ceiling; sentinel nameslist_repo_labels+ nextpage - 4.5 Register
forgejo://org/{org}/labels{?page,limit}→ same page/limit bound; sentinel nameslist_org_labels+ nextpage - 4.6 Reject scope-less
forgejo://label/{id}URIs (repo/org ids share an int space) in the parser - 4.7 Map
403→-32002,404→-32003viaMapForgejoErrorfor all reads - 4.8 Wire
RegisterLabelResourcesfromoperation/operation.go - 4.9 Unit tests: single label happy path, non-numeric id, scope-less URI rejected, 404, 403; repo list under/over-cap +
limithonoured (sentinellist_repo_labels+ next page), repo list 404; org list over-cap (sentinellist_org_labels), org list 404 - 4.10 Confirm all three list/single resources satisfy the
mcp-resources-core"Collection resource" requirement (cap =EmbeddedListCap, shared sentinel,list_repo_labels/list_org_labelstools untouched) - 4.11 README "Resources" section +
AGENTS.mdresource table: add all three label templates
5. Wrap-up
- 5.1
make build+make vendorclean; all tests pass - 5.2 README tool table +
AGENTS.md: add the eight label tools soToolSearchforlabelsurfaces them - 5.3 Tick Codeberg #190 acceptance-criteria checkboxes (tools + resources); note
exclusive/is_archivedstill out of scope on both transports