fix: include label ID in markdown output#11
Open
7sorium wants to merge 1 commit into
Open
Conversation
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`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Mirrors the milestone-ID fix in 861d234 for labels.
(*Label).ToMarkdown()andLabelList.ToMarkdown()now include the label's numericIDin#Nformat alongside the name, color, and description.Before:
After:
Why
create_issuerequireslabels: []int(label IDs), but the output oflist_repo_labelspreviously 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 havinglist_repo_labelsas 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_issuerejected the string array withcannot unmarshal string into Go struct field CreateIssueParams.labels of type int, and the workaround was a manualcurl /api/v1/repos/{owner}/{repo}/labelsto look up the IDs. With this change,list_repo_labelsis self-sufficient.Format
Matches the milestone fix exactly:
**Name** #IDprefix, with the existing color/description suffix untouched. Both single-label and label-list views updated.Tests
TestLabel_ToMarkdownto assert the#1ID is present in the output (testLabel()already setsID: 1).go build ./...andgo test ./...pass.