Skip to content

Commit 2a66879

Browse files
committed
Simplify tool description
1 parent 0c90263 commit 2a66879

3 files changed

Lines changed: 23 additions & 3 deletions

File tree

pkg/github/__toolsnaps__/list_repository_collaborators.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"readOnlyHint": true,
44
"title": "List repository collaborators"
55
},
6-
"description": "List collaborators of a GitHub repository. Lists users who have access to the repository. Includes their username, ID, and role name.",
6+
"description": "List collaborators of a GitHub repository.",
77
"inputSchema": {
88
"properties": {
99
"affiliation": {

pkg/github/repositories.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2247,7 +2247,7 @@ func ListRepositoryCollaborators(t translations.TranslationHelperFunc) inventory
22472247
ToolsetMetadataRepos,
22482248
mcp.Tool{
22492249
Name: "list_repository_collaborators",
2250-
Description: t("TOOL_LIST_REPOSITORY_COLLABORATORS_DESCRIPTION", "List collaborators of a GitHub repository. Lists users who have access to the repository. Includes their username, ID, and role name."),
2250+
Description: t("TOOL_LIST_REPOSITORY_COLLABORATORS_DESCRIPTION", "List collaborators of a GitHub repository."),
22512251
Annotations: &mcp.ToolAnnotations{
22522252
Title: t("TOOL_LIST_REPOSITORY_COLLABORATORS_USER_TITLE", "List repository collaborators"),
22532253
ReadOnlyHint: true,
@@ -2322,7 +2322,7 @@ func ListRepositoryCollaborators(t translations.TranslationHelperFunc) inventory
23222322
return ghErrors.NewGitHubAPIStatusErrorResponse(ctx, "failed to list collaborators", resp, body), nil, nil
23232323
}
23242324

2325-
var result []MinimalCollaborator
2325+
result := make([]MinimalCollaborator, 0, len(collaborators))
23262326
for _, c := range collaborators {
23272327
result = append(result, MinimalCollaborator{
23282328
Login: c.GetLogin(),

pkg/github/repositories_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4459,6 +4459,19 @@ func Test_ListRepositoryCollaborators(t *testing.T) {
44594459
mockResponses: []MockBackendOption{},
44604460
errContains: "missing required parameter: repo",
44614461
},
4462+
{
4463+
name: "empty collaborators returns empty array",
4464+
args: map[string]any{
4465+
"owner": "owner",
4466+
"repo": "repo",
4467+
},
4468+
mockResponses: []MockBackendOption{
4469+
WithRequestMatch(
4470+
GetReposCollaboratorsByOwnerByRepo,
4471+
[]*github.User{},
4472+
),
4473+
},
4474+
},
44624475
}
44634476

44644477
for _, tt := range tests {
@@ -4486,6 +4499,13 @@ func Test_ListRepositoryCollaborators(t *testing.T) {
44864499
var collaborators []MinimalCollaborator
44874500
err = json.Unmarshal([]byte(textContent.Text), &collaborators)
44884501
require.NoError(t, err)
4502+
4503+
if tt.name == "empty collaborators returns empty array" {
4504+
assert.Empty(t, collaborators)
4505+
assert.Equal(t, "[]", textContent.Text)
4506+
return
4507+
}
4508+
44894509
assert.Len(t, collaborators, 2)
44904510
assert.Equal(t, "user1", collaborators[0].Login)
44914511
assert.Equal(t, int64(101), collaborators[0].ID)

0 commit comments

Comments
 (0)