Adds the spec-driven change artifacts for exposing Forgejo organization labels through the MCP server: - proposal: motivation, capabilities, impact - design: decisions, trade-offs, impl approach via DoJSONList - specs: new list_org_labels capability + modified list_repo_labels with include_org_labels merge and scope tagging - tasks: 5-group breakdown covering helper, new tool, augmentation, docs, and verification Tracked as forgejo-mcp-7ch (blocked by forgejo-mcp-xv0 OpenSpec). Closes forgejo-mcp-xv0.
2.3 KiB
2.3 KiB
1. Wire raw-HTTP fetch for org labels
- 1.1 Add a small
OrgLabel(or sharedLabel) struct inoperation/issue/with fieldsid,name,color,description,scope - 1.2 Add a helper
fetchOrgLabels(ctx, org, page, limit) ([]Label, error)that callspkg/forgejo.DoJSONListagainst/orgs/{org}/labels?page=&limit=and stampsscope: "org"on each entry - 1.3 Confirm 404 → empty behavior is preserved (helper already maps it); add a unit test that asserts no error on 404
2. New list_org_labels MCP tool
- 2.1 Add
ListOrgLabelsToolNameconstant andListOrgLabelsToolmcp.NewTool(...)definition withorg,page,limitparameters inoperation/issue/issue.go - 2.2 Implement
ListOrgLabelsFnhandler using the helper from 1.2; returnto.TextResult(labels) - 2.3 Register the tool in
RegisterTool(s *server.MCPServer) - 2.4 Unit test against
httptest.Server(pattern inpkg/forgejo/raw_http_test.go): success path, empty path, 401 →ErrUnauthorized
3. Augment list_repo_labels with org merge
- 3.1 Add
include_org_labelsboolean parameter (defaulttrue) toListRepoLabelsTooldefinition - 3.2 Update
ListRepoLabelsFnto:- call existing SDK
ListRepoLabelsand stampscope: "repo"on each result - when
include_org_labelsis true, callfetchOrgLabels(ctx, owner, page, limit)and append results - propagate errors from the org call except 404 (helper handles), and except when
include_org_labelsis false
- call existing SDK
- 3.3 Unit tests for: org-owned repo merged result, user-owned repo (org call 404 → empty),
include_org_labels=falsereturns repo-only, 401 from org endpoint surfaces asErrUnauthorized
4. Documentation
- 4.1 Update
docs/PROMPTING.mdif it references label discovery flows - 4.2 Update
README.mdtool list with the newlist_org_labelsentry - 4.3 Add a one-line CHANGELOG/release-note entry referencing Codeberg #125
5. Verification
- 5.1
make buildpasses - 5.2
go test ./...passes - 5.3
openspec validate add-org-label-support --strictpasses - 5.4 Manual smoke against a Codeberg org-owned repo:
list_org_labelsreturns expected labels;list_repo_labelsincludes them withscope: "org" - 5.5 Comment back on Codeberg issue #125 with the PR link once merged