Skip to content

fix: include label ID in markdown output#11

Open
7sorium wants to merge 1 commit into
raohwork:masterfrom
7sorium:show-label-id-in-list
Open

fix: include label ID in markdown output#11
7sorium wants to merge 1 commit into
raohwork:masterfrom
7sorium:show-label-id-in-list

Conversation

@7sorium

@7sorium 7sorium commented May 28, 2026

Copy link
Copy Markdown

Summary

Mirrors the milestone-ID fix in 861d234 for labels.

(*Label).ToMarkdown() and LabelList.ToMarkdown() now include the label's numeric ID in #N format alongside the name, color, and description.

Before:

- **bug** `#d73a4a` - Something isn't working
- **enhancement** `#a2eeef` - New feature or request

After:

- **bug** #59 `#d73a4a` - Something isn't working
- **enhancement** #64 `#a2eeef` - New feature or request

Why

create_issue requires labels: []int (label IDs), but the output of list_repo_labels previously didn't include the IDs. That forces MCP clients to hit the Forgejo HTTP API directly to map label names to IDs before they can attach labels to a new issue — defeating the point of having list_repo_labels as a tool.

Hit this in real use today: an agent went to file two tickets in a Forgejo repo with labels like bug/enhancement/priority/high, create_issue rejected the string array with cannot unmarshal string into Go struct field CreateIssueParams.labels of type int, and the workaround was a manual curl /api/v1/repos/{owner}/{repo}/labels to look up the IDs. With this change, list_repo_labels is self-sufficient.

Format

Matches the milestone fix exactly: **Name** #ID prefix, with the existing color/description suffix untouched. Both single-label and label-list views updated.

Tests

  • Extended TestLabel_ToMarkdown to assert the #1 ID is present in the output (testLabel() already sets ID: 1).
  • go build ./... and go test ./... pass.

Add label ID (#N format) to label display in both single label and
label list views, mirroring the milestone change in 861d234. Without
the ID in the output, create_issue (which requires `labels: []int`)
forces callers to hit the Forgejo HTTP API directly to map names to
IDs, making list_repo_labels insufficient on its own.

Format aligns with the milestone fix: `**name** #ID \`#color\` - desc`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants