Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 13 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -668,15 +668,6 @@ The following sets of tools are available (all are on by default):
- `title`: New title (string, optional)
- `type`: New issue type (string, optional)

- **write_label** - Write operations on repository labels.
- `color`: Label color as 6-character hex code without '#' prefix (e.g., 'f29513'). Required for 'create', optional for 'update'. (string, optional)
- `description`: Label description text. Optional for 'create' and 'update'. (string, optional)
- `method`: Operation to perform: 'create', 'update', or 'delete' (string, required)
- `name`: Label name - required for all operations (string, required)
- `new_name`: New name for the label (used only with 'update' method to rename) (string, optional)
- `owner`: Repository owner (username or organization name) (string, required)
- `repo`: Repository name (string, required)

</details>

<details>
Expand All @@ -688,12 +679,7 @@ The following sets of tools are available (all are on by default):
- `owner`: Repository owner (username or organization name) (string, required)
- `repo`: Repository name (string, required)

- **list_label** - List labels from a repository or an issue
- `issue_number`: Issue number - if provided, lists labels on the specific issue (number, optional)
- `owner`: Repository owner (username or organization name) - required for all operations (string, required)
- `repo`: Repository name - required for all operations (string, required)

- **write_label** - Write operations on repository labels.
- **label_write** - Write operations on repository labels.
- `color`: Label color as 6-character hex code without '#' prefix (e.g., 'f29513'). Required for 'create', optional for 'update'. (string, optional)
- `description`: Label description text. Optional for 'create' and 'update'. (string, optional)
- `method`: Operation to perform: 'create', 'update', or 'delete' (string, required)
Expand All @@ -702,6 +688,11 @@ The following sets of tools are available (all are on by default):
- `owner`: Repository owner (username or organization name) (string, required)
- `repo`: Repository name (string, required)

- **list_label** - List labels from a repository or an issue
- `issue_number`: Issue number - if provided, lists labels on the specific issue (number, optional)
- `owner`: Repository owner (username or organization name) - required for all operations (string, required)
- `repo`: Repository name - required for all operations (string, required)

</details>

<details>
Expand Down Expand Up @@ -806,6 +797,13 @@ The following sets of tools are available (all are on by default):
- `per_page`: Number of results per page (max 100, default: 30) (number, optional)
- `query`: Filter projects by a search query (matches title and description) (string, optional)

- **update_project_item** - Update project item
- `item_id`: The unique identifier of the project item. This is not the issue or pull request ID. (number, required)
- `owner`: If owner_type == user it is the handle for the GitHub user account. If owner_type == org it is the name of the organization. The name is not case sensitive. (string, required)
- `owner_type`: Owner type (string, required)
- `project_number`: The project's number. (number, required)
- `updated_field`: Object consisting of the ID of the project field to update and the new value for the field. To clear the field, set "value" to null. Example: {"id": 123456, "value": "New Value"} (object, required)

</details>

<details>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,5 @@
],
"type": "object"
},
"name": "write_label"
"name": "label_write"
}
13 changes: 7 additions & 6 deletions pkg/github/__toolsnaps__/update_project_item.snap
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@
"description": "Update a specific Project item for a user or org",
"inputSchema": {
"properties": {
"fields": {
"description": "A list of field updates to apply.",
"type": "array"
},
"item_id": {
"description": "The numeric ID of the project item to update (not the issue or pull request ID).",
"description": "The unique identifier of the project item. This is not the issue or pull request ID.",
"type": "number"
},
"owner": {
Expand All @@ -29,14 +25,19 @@
"project_number": {
"description": "The project's number.",
"type": "number"
},
"updated_field": {
"description": "Object consisting of the ID of the project field to update and the new value for the field. To clear the field, set \"value\" to null. Example: {\"id\": 123456, \"value\": \"New Value\"}",
"properties": {},
"type": "object"
}
},
"required": [
"owner_type",
"owner",
"project_number",
"item_id",
"fields"
"updated_field"
],
"type": "object"
},
Expand Down
10 changes: 5 additions & 5 deletions pkg/github/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,13 +239,13 @@ func ListLabels(getGQLClient GetGQLClientFn, t translations.TranslationHelperFun
}
}

// WriteLabel handles create, update, and delete operations for GitHub labels
func WriteLabel(getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) {
// LabelWrite handles create, update, and delete operations for GitHub labels
func LabelWrite(getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) {
return mcp.NewTool(
"write_label",
mcp.WithDescription(t("TOOL_WRITE_LABEL_DESCRIPTION", "Perform write operations on repository labels. To set labels on issues, use the 'update_issue' tool.")),
"label_write",
mcp.WithDescription(t("TOOL_LABEL_WRITE_DESCRIPTION", "Perform write operations on repository labels. To set labels on issues, use the 'update_issue' tool.")),
mcp.WithToolAnnotation(mcp.ToolAnnotation{
Title: t("TOOL_WRITE_LABEL_TITLE", "Write operations on repository labels."),
Title: t("TOOL_LABEL_WRITE_TITLE", "Write operations on repository labels."),
ReadOnlyHint: ToBoolPtr(false),
}),
mcp.WithString("method",
Expand Down
6 changes: 3 additions & 3 deletions pkg/github/labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,10 +291,10 @@ func TestWriteLabel(t *testing.T) {

// Verify tool definition
mockClient := githubv4.NewClient(nil)
tool, _ := WriteLabel(stubGetGQLClientFn(mockClient), translations.NullTranslationHelper)
tool, _ := LabelWrite(stubGetGQLClientFn(mockClient), translations.NullTranslationHelper)
require.NoError(t, toolsnaps.Test(tool.Name, tool))

assert.Equal(t, "write_label", tool.Name)
assert.Equal(t, "label_write", tool.Name)
assert.NotEmpty(t, tool.Description)
assert.Contains(t, tool.InputSchema.Properties, "method")
assert.Contains(t, tool.InputSchema.Properties, "owner")
Expand Down Expand Up @@ -520,7 +520,7 @@ func TestWriteLabel(t *testing.T) {
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
client := githubv4.NewClient(tc.mockedClient)
_, handler := WriteLabel(stubGetGQLClientFn(client), translations.NullTranslationHelper)
_, handler := LabelWrite(stubGetGQLClientFn(client), translations.NullTranslationHelper)

request := createMCPRequest(tc.requestArgs)
result, err := handler(context.Background(), request)
Expand Down
4 changes: 4 additions & 0 deletions pkg/github/minimal_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ type MinimalProject struct {
type MinimalProjectItem struct {
ID *int64 `json:"id,omitempty"`
NodeID *string `json:"node_id,omitempty"`
Title *string `json:"title,omitempty"`
Description *string `json:"description,omitempty"`
ProjectNodeID *string `json:"project_node_id,omitempty"`
ContentNodeID *string `json:"content_node_id,omitempty"`
ProjectURL *string `json:"project_url,omitempty"`
Expand Down Expand Up @@ -192,6 +194,8 @@ func convertToMinimalProjectItem(item *projectV2Item) *MinimalProjectItem {
return &MinimalProjectItem{
ID: item.ID,
NodeID: item.NodeID,
Title: item.Title,
Description: item.Description,
ProjectNodeID: item.ProjectNodeID,
ContentNodeID: item.ContentNodeID,
ProjectURL: item.ProjectURL,
Expand Down
Loading
Loading