Skip to content

Commit 04c0df3

Browse files
Restore labels toolset with get_label in both issues and labels
This restores conformance with the original behavior where: - get_label is in issues toolset (read-only label access for issue workflows) - get_label, list_label, label_write are in labels toolset (full management) The duplicate get_label registration is intentional - it was in both toolsets in the original implementation. Added test exception to allow this case.
1 parent af4830c commit 04c0df3

File tree

5 files changed

+51
-17
lines changed

5 files changed

+51
-17
lines changed

README.md

Lines changed: 25 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,7 @@ The following sets of tools are available:
463463
| `gists` | GitHub Gist related tools |
464464
| `git` | GitHub Git API related tools for low-level Git operations |
465465
| `issues` | GitHub Issues related tools |
466+
| `labels` | GitHub Labels related tools |
466467
| `notifications` | GitHub Notifications related tools |
467468
| `orgs` | GitHub Organization related tools |
468469
| `projects` | GitHub Projects related tools |
@@ -755,15 +756,6 @@ The following sets of tools are available:
755756
- `title`: Issue title (string, optional)
756757
- `type`: Type of this issue. Only use if the repository has issue types configured. Use list_issue_types tool to get valid type values for the organization. If the repository doesn't support issue types, omit this parameter. (string, optional)
757758

758-
- **label_write** - Write operations on repository labels.
759-
- `color`: Label color as 6-character hex code without '#' prefix (e.g., 'f29513'). Required for 'create', optional for 'update'. (string, optional)
760-
- `description`: Label description text. Optional for 'create' and 'update'. (string, optional)
761-
- `method`: Operation to perform: 'create', 'update', or 'delete' (string, required)
762-
- `name`: Label name - required for all operations (string, required)
763-
- `new_name`: New name for the label (used only with 'update' method to rename) (string, optional)
764-
- `owner`: Repository owner (username or organization name) (string, required)
765-
- `repo`: Repository name (string, required)
766-
767759
- **list_issue_types** - List available issue types
768760
- `owner`: The organization owner of the repository (string, required)
769761

@@ -778,10 +770,6 @@ The following sets of tools are available:
778770
- `since`: Filter by date (ISO 8601 timestamp) (string, optional)
779771
- `state`: Filter by state, by default both open and closed issues are returned when not provided (string, optional)
780772

781-
- **list_label** - List labels from a repository
782-
- `owner`: Repository owner (username or organization name) - required for all operations (string, required)
783-
- `repo`: Repository name - required for all operations (string, required)
784-
785773
- **search_issues** - Search issues
786774
- `order`: Sort order (string, optional)
787775
- `owner`: Optional repository owner. If provided with repo, only issues for this repository are listed. (string, optional)
@@ -810,6 +798,30 @@ The following sets of tools are available:
810798

811799
<details>
812800

801+
<summary>Labels</summary>
802+
803+
- **get_label** - Get a specific label from a repository.
804+
- `name`: Label name. (string, required)
805+
- `owner`: Repository owner (username or organization name) (string, required)
806+
- `repo`: Repository name (string, required)
807+
808+
- **label_write** - Write operations on repository labels.
809+
- `color`: Label color as 6-character hex code without '#' prefix (e.g., 'f29513'). Required for 'create', optional for 'update'. (string, optional)
810+
- `description`: Label description text. Optional for 'create' and 'update'. (string, optional)
811+
- `method`: Operation to perform: 'create', 'update', or 'delete' (string, required)
812+
- `name`: Label name - required for all operations (string, required)
813+
- `new_name`: New name for the label (used only with 'update' method to rename) (string, optional)
814+
- `owner`: Repository owner (username or organization name) (string, required)
815+
- `repo`: Repository name (string, required)
816+
817+
- **list_label** - List labels from a repository
818+
- `owner`: Repository owner (username or organization name) - required for all operations (string, required)
819+
- `repo`: Repository name - required for all operations (string, required)
820+
821+
</details>
822+
823+
<details>
824+
813825
<summary>Notifications</summary>
814826

815827
- **dismiss_notification** - Dismiss notification

docs/remote-server.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ Below is a table of available toolsets for the remote GitHub MCP Server. Each to
2727
| Gists | GitHub Gist related tools | https://api.githubcopilot.com/mcp/x/gists | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-gists&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgists%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/gists/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-gists&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgists%2Freadonly%22%7D) |
2828
| Git | GitHub Git API related tools for low-level Git operations | https://api.githubcopilot.com/mcp/x/git | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-git&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgit%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/git/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-git&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fgit%2Freadonly%22%7D) |
2929
| Issues | GitHub Issues related tools | https://api.githubcopilot.com/mcp/x/issues | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-issues&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fissues%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/issues/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-issues&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fissues%2Freadonly%22%7D) |
30+
| Labels | GitHub Labels related tools | https://api.githubcopilot.com/mcp/x/labels | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-labels&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Flabels%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/labels/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-labels&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Flabels%2Freadonly%22%7D) |
3031
| Notifications | GitHub Notifications related tools | https://api.githubcopilot.com/mcp/x/notifications | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-notifications&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fnotifications%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/notifications/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-notifications&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fnotifications%2Freadonly%22%7D) |
3132
| Organizations | GitHub Organization related tools | https://api.githubcopilot.com/mcp/x/orgs | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-orgs&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Forgs%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/orgs/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-orgs&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Forgs%2Freadonly%22%7D) |
3233
| Projects | GitHub Projects related tools | https://api.githubcopilot.com/mcp/x/projects | [Install](https://insiders.vscode.dev/redirect/mcp/install?name=gh-projects&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fprojects%22%7D) | [read-only](https://api.githubcopilot.com/mcp/x/projects/readonly) | [Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=gh-projects&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Fx%2Fprojects%2Freadonly%22%7D) |

pkg/github/labels.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,18 @@ func GetLabel(t translations.TranslationHelperFunc) registry.ServerTool {
110110
)
111111
}
112112

113+
// GetLabelForLabelsToolset returns the same GetLabel tool but registered in the labels toolset.
114+
// This provides conformance with the original behavior where get_label was in both toolsets.
115+
func GetLabelForLabelsToolset(t translations.TranslationHelperFunc) registry.ServerTool {
116+
tool := GetLabel(t)
117+
tool.Toolset = ToolsetLabels
118+
return tool
119+
}
120+
113121
// ListLabels lists labels from a repository
114122
func ListLabels(t translations.TranslationHelperFunc) registry.ServerTool {
115123
return NewTool(
116-
ToolsetMetadataIssues,
124+
ToolsetLabels,
117125
mcp.Tool{
118126
Name: "list_label",
119127
Description: t("TOOL_LIST_LABEL_DESCRIPTION", "List labels from a repository"),
@@ -205,7 +213,7 @@ func ListLabels(t translations.TranslationHelperFunc) registry.ServerTool {
205213
// LabelWrite handles create, update, and delete operations for GitHub labels
206214
func LabelWrite(t translations.TranslationHelperFunc) registry.ServerTool {
207215
return NewTool(
208-
ToolsetMetadataIssues,
216+
ToolsetLabels,
209217
mcp.Tool{
210218
Name: "label_write",
211219
Description: t("TOOL_LABEL_WRITE_DESCRIPTION", "Perform write operations on repository labels. To set labels on issues, use the 'update_issue' tool."),

pkg/github/tools.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ var (
106106
ID: "dynamic",
107107
Description: "Discover GitHub MCP tools that can help achieve tasks by enabling additional sets of tools, you can control the enablement of any toolset to access its tools when this toolset is enabled.",
108108
}
109+
ToolsetLabels = registry.ToolsetMetadata{
110+
ID: "labels",
111+
Description: "GitHub Labels related tools",
112+
}
109113
)
110114

111115
// AllTools returns all tools with their embedded toolset metadata.
@@ -237,6 +241,7 @@ func AllTools(t translations.TranslationHelperFunc) []registry.ServerTool {
237241

238242
// Label tools
239243
GetLabel(t),
244+
GetLabelForLabelsToolset(t),
240245
ListLabels(t),
241246
LabelWrite(t),
242247
}

pkg/github/tools_validation_test.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,18 @@ func TestNoDuplicateToolNames(t *testing.T) {
102102
tools := AllTools(stubTranslation)
103103
seen := make(map[string]bool)
104104

105+
// get_label is intentionally in both issues and labels toolsets for conformance
106+
// with original behavior where it was registered in both
107+
allowedDuplicates := map[string]bool{
108+
"get_label": true,
109+
}
110+
105111
for _, tool := range tools {
106112
name := tool.Tool.Name
107-
assert.False(t, seen[name],
108-
"Duplicate tool name found: %q", name)
113+
if !allowedDuplicates[name] {
114+
assert.False(t, seen[name],
115+
"Duplicate tool name found: %q", name)
116+
}
109117
seen[name] = true
110118
}
111119
}

0 commit comments

Comments
 (0)