MCPcopy
hub / github.com/github/github-mcp-server / ListRepositoryCollaborators

Function ListRepositoryCollaborators

pkg/github/repositories.go:2689–2800  ·  view source on GitHub ↗

ListRepositoryCollaborators creates a tool to list collaborators of a GitHub repository.

(t translations.TranslationHelperFunc)

Source from the content-addressed store, hash-verified

2687
2688// ListRepositoryCollaborators creates a tool to list collaborators of a GitHub repository.
2689func ListRepositoryCollaborators(t translations.TranslationHelperFunc) inventory.ServerTool {
2690 return NewTool(
2691 ToolsetMetadataRepos,
2692 mcp.Tool{
2693 Name: "list_repository_collaborators",
2694 Description: t("TOOL_LIST_REPOSITORY_COLLABORATORS_DESCRIPTION", "List collaborators of a GitHub repository. Results are paginated; the response includes `nextPage`, `prevPage`, `firstPage`, and `lastPage` fields. To get the next page, use the `nextPage` value as the `page` parameter."),
2695 Annotations: &mcp.ToolAnnotations{
2696 Title: t("TOOL_LIST_REPOSITORY_COLLABORATORS_USER_TITLE", "List repository collaborators"),
2697 ReadOnlyHint: true,
2698 },
2699 InputSchema: func() *jsonschema.Schema {
2700 schema := WithPagination(&jsonschema.Schema{
2701 Type: "object",
2702 Properties: map[string]*jsonschema.Schema{
2703 "owner": {
2704 Type: "string",
2705 Description: "Repository owner",
2706 },
2707 "repo": {
2708 Type: "string",
2709 Description: "Repository name",
2710 },
2711 "affiliation": {
2712 Type: "string",
2713 Description: "Filter by affiliation. Can be one of: 'outside' (outside collaborators), 'direct' (all with permissions regardless of org membership), 'all' (all collaborators). Default: 'all'",
2714 Enum: []any{"outside", "direct", "all"},
2715 },
2716 },
2717 Required: []string{"owner", "repo"},
2718 })
2719 schema.Properties["page"].Description = "Page number for pagination (default 1, min 1)"
2720 schema.Properties["perPage"].Description = "Results per page for pagination (default 30, min 1, max 100)"
2721 return schema
2722 }(),
2723 },
2724 []scopes.Scope{scopes.Repo},
2725 func(ctx context.Context, deps ToolDependencies, _ *mcp.CallToolRequest, args map[string]any) (*mcp.CallToolResult, any, error) {
2726 owner, err := RequiredParam[string](args, "owner")
2727 if err != nil {
2728 return utils.NewToolResultError(err.Error()), nil, nil
2729 }
2730 repo, err := RequiredParam[string](args, "repo")
2731 if err != nil {
2732 return utils.NewToolResultError(err.Error()), nil, nil
2733 }
2734 affiliation, err := OptionalParam[string](args, "affiliation")
2735 if err != nil {
2736 return utils.NewToolResultError(err.Error()), nil, nil
2737 }
2738 pagination, err := OptionalPaginationParams(args)
2739 if err != nil {
2740 return utils.NewToolResultError(err.Error()), nil, nil
2741 }
2742
2743 client, err := deps.GetClient(ctx)
2744 if err != nil {
2745 return nil, nil, fmt.Errorf("failed to get GitHub client: %w", err)
2746 }

Callers 2

AllToolsFunction · 0.85

Calls 10

NewToolResultErrorFunction · 0.92
LabelCollaboratorRosterFunction · 0.92
NewToolFunction · 0.85
WithPaginationFunction · 0.85
OptionalPaginationParamsFunction · 0.85
MarshalledTextResultFunction · 0.85
attachStaticIFCLabelFunction · 0.85
CloseMethod · 0.80
GetClientMethod · 0.65
ErrorMethod · 0.45

Tested by 1