Skip to content

Commit 5672632

Browse files
committed
GetTeams - rename "login" field to "org"
1 parent 2b7fccf commit 5672632

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

pkg/github/context_tools.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -92,18 +92,18 @@ func GetMe(getClient GetClientFn, t translations.TranslationHelperFunc) (mcp.Too
9292
return tool, handler
9393
}
9494

95-
func GetTeams(getClient GetClientFn, getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) {
96-
type TeamInfo struct {
97-
Name string `json:"name"`
98-
Slug string `json:"slug"`
99-
Description string `json:"description"`
100-
}
95+
type TeamInfo struct {
96+
Name string `json:"name"`
97+
Slug string `json:"slug"`
98+
Description string `json:"description"`
99+
}
101100

102-
type OrganizationTeams struct {
103-
Login string `json:"login"`
104-
Teams []TeamInfo `json:"teams"`
105-
}
101+
type OrganizationTeams struct {
102+
Org string `json:"org"`
103+
Teams []TeamInfo `json:"teams"`
104+
}
106105

106+
func GetTeams(getClient GetClientFn, getGQLClient GetGQLClientFn, t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) {
107107
return mcp.NewTool("get_teams",
108108
mcp.WithDescription(t("TOOL_GET_TEAMS_DESCRIPTION", "Get details of the teams the user is a member of. Limited to organizations accessible with current credentials")),
109109
mcp.WithString("user",
@@ -171,7 +171,7 @@ func GetTeams(getClient GetClientFn, getGQLClient GetGQLClientFn, t translations
171171
var organizations []OrganizationTeams
172172
for _, org := range q.User.Organizations.Nodes {
173173
orgTeams := OrganizationTeams{
174-
Login: string(org.Login),
174+
Org: string(org.Login),
175175
Teams: make([]TeamInfo, 0, len(org.Teams.Nodes)),
176176
}
177177

pkg/github/context_tools_test.go

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -345,28 +345,21 @@ func Test_GetTeams(t *testing.T) {
345345
return
346346
}
347347

348-
var organizations []struct {
349-
Login string `json:"login"`
350-
Teams []struct {
351-
Name string `json:"name"`
352-
Slug string `json:"slug"`
353-
Description string `json:"description"`
354-
} `json:"teams"`
355-
}
348+
var organizations []OrganizationTeams
356349
err = json.Unmarshal([]byte(textContent.Text), &organizations)
357350
require.NoError(t, err)
358351

359352
assert.Len(t, organizations, tc.expectedTeamsCount)
360353

361354
if tc.expectedTeamsCount > 0 {
362-
assert.Equal(t, "testorg1", organizations[0].Login)
355+
assert.Equal(t, "testorg1", organizations[0].Org)
363356
assert.Len(t, organizations[0].Teams, 2)
364357
assert.Equal(t, "team1", organizations[0].Teams[0].Name)
365358
assert.Equal(t, "team1", organizations[0].Teams[0].Slug)
366359
assert.Equal(t, "Team 1", organizations[0].Teams[0].Description)
367360

368361
if tc.expectedTeamsCount > 1 {
369-
assert.Equal(t, "testorg2", organizations[1].Login)
362+
assert.Equal(t, "testorg2", organizations[1].Org)
370363
assert.Len(t, organizations[1].Teams, 1)
371364
assert.Equal(t, "team3", organizations[1].Teams[0].Name)
372365
assert.Equal(t, "team3", organizations[1].Teams[0].Slug)

0 commit comments

Comments
 (0)