MCPcopy Index your code
hub / github.com/github/github-mcp-server / GetTeamMembers

Function GetTeamMembers

pkg/github/context_tools.go:229–303  ·  view source on GitHub ↗
(t translations.TranslationHelperFunc)

Source from the content-addressed store, hash-verified

227}
228
229func GetTeamMembers(t translations.TranslationHelperFunc) inventory.ServerTool {
230 return NewTool(
231 ToolsetMetadataContext,
232 mcp.Tool{
233 Name: "get_team_members",
234 Description: t("TOOL_GET_TEAM_MEMBERS_DESCRIPTION", "Get member usernames of a specific team in an organization. Limited to organizations accessible with current credentials"),
235 Annotations: &mcp.ToolAnnotations{
236 Title: t("TOOL_GET_TEAM_MEMBERS_TITLE", "Get team members"),
237 ReadOnlyHint: true,
238 },
239 InputSchema: &jsonschema.Schema{
240 Type: "object",
241 Properties: map[string]*jsonschema.Schema{
242 "org": {
243 Type: "string",
244 Description: t("TOOL_GET_TEAM_MEMBERS_ORG_DESCRIPTION", "Organization login (owner) that contains the team."),
245 },
246 "team_slug": {
247 Type: "string",
248 Description: t("TOOL_GET_TEAM_MEMBERS_TEAM_SLUG_DESCRIPTION", "Team slug"),
249 },
250 },
251 Required: []string{"org", "team_slug"},
252 },
253 },
254 []scopes.Scope{scopes.ReadOrg},
255 func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
256 org, err := RequiredParam[string](args, "org")
257 if err != nil {
258 return utils.NewToolResultError(err.Error()), nil, nil
259 }
260
261 teamSlug, err := RequiredParam[string](args, "team_slug")
262 if err != nil {
263 return utils.NewToolResultError(err.Error()), nil, nil
264 }
265
266 gqlClient, err := deps.GetGQLClient(ctx)
267 if err != nil {
268 return utils.NewToolResultErrorFromErr("failed to get GitHub GQL client", err), nil, nil
269 }
270
271 var q struct {
272 Organization struct {
273 Team struct {
274 Members struct {
275 Nodes []struct {
276 Login githubv4.String
277 }
278 } `graphql:"members(first: 100)"`
279 } `graphql:"team(slug: $teamSlug)"`
280 } `graphql:"organization(login: $org)"`
281 }
282 vars := map[string]any{
283 "org": githubv4.String(org),
284 "teamSlug": githubv4.String(teamSlug),
285 }
286 if err := gqlClient.Query(ctx, &q, vars); err != nil {

Callers 2

AllToolsFunction · 0.85
Test_GetTeamMembersFunction · 0.85

Calls 9

NewToolResultErrorFunction · 0.92
LabelTeamFunction · 0.92
NewToolFunction · 0.85
MarshalledTextResultFunction · 0.85
attachStaticIFCLabelFunction · 0.85
GetGQLClientMethod · 0.65
ErrorMethod · 0.45
StringMethod · 0.45

Tested by 1

Test_GetTeamMembersFunction · 0.68