Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: Add get organization members and list all outside collaborators of an organization#1508

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
cointem wants to merge4 commits intogithub:main
base:main
Choose a base branch
Loading
fromcointem:feature/org

Conversation

@cointem
Copy link

This pull request adds two new tools for organization management in the GitHub integration, along with their documentation, implementation, and test coverage. The new tools enable fetching organization members and listing outside collaborators, both with support for pagination and filtering. The changes are grouped into tool additions, documentation updates, and test enhancements.

New organization management tools:

  • Added theget_org_members tool, which retrieves members of a specified organization, with support for pagination and filtering by role (all,admin,member).[1][2]
  • Added thelist_outside_collaborators tool, which lists users who have access to organization repositories but are not organization members, also supporting pagination.[1][2]
  • Registered both new tools in the default toolset group so they are available for use.

Documentation updates:

  • UpdatedREADME.md to include usage details for the newget_org_members andlist_outside_collaborators tools, including their parameters and descriptions.

Test coverage:

  • Added comprehensive unit tests for both new tools, covering successful calls, empty results, client errors, and API errors.

These changes improve the ability to manage and audit organization membership and access via the GitHub integration.

@cointemcointem requested a review froma team as acode ownerNovember 29, 2025 16:32
CopilotAI review requested due to automatic review settingsNovember 29, 2025 16:32
@cointem
Copy link
Author

refs#1331

Copilot finished reviewing on behalf ofcointemNovember 29, 2025 16:36
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull request overview

This PR adds two new tools for organization management:get_org_members to retrieve organization members with role filtering and pagination, andlist_outside_collaborators to list users with repository access who aren't organization members. The implementation follows existing patterns with comprehensive test coverage and documentation updates.

  • Adds organization member and outside collaborator listing capabilities
  • Includes full test coverage with success and error scenarios
  • Updates README and toolsnap schema files

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
FileDescription
pkg/github/context_tools.goImplements the two new organization tools with pagination support and user data transformation
pkg/github/context_tools_test.goAdds comprehensive unit tests for both tools covering success, empty results, client errors, and API errors
pkg/github/tools.goRegisters the new tools in the context toolset and refactors type declarations into grouped format
pkg/github/toolsnaps/get_org_members.snapDocuments the API schema for the get_org_members tool
pkg/github/toolsnaps/list_outside_collaborators.snapDocuments the API schema for the list_outside_collaborators tool
README.mdAdds documentation for both new tools in the Context section

fix: change method name capitalization to adjust export visibility
@cointemcointem requested a review fromCopilotDecember 1, 2025 12:21
Copilot finished reviewing on behalf ofcointemDecember 1, 2025 12:25
Copy link
Contributor

CopilotAI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 6 comments.

Comment on lines +383 to +385
org:=params.Org
perPage:=params.PerPage
page:=params.Page
Copy link

CopilotAIDec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

These intermediate variable assignments (lines 383-385) are unnecessary and reduce code clarity. The params struct fields (params.Org,params.PerPage,params.Page) can be used directly throughout the function, which is the pattern followed by other tools in the codebase (e.g.,GetDiscussion andGetDiscussionComments indiscussions.go).

Copilot uses AI. Check for mistakes.
Comment on lines +110 to +116
typeOutUserstruct {
Loginstring`json:"login"`
IDstring`json:"id"`
AvatarURLstring`json:"avatar_url"`
Typestring`json:"type"`
SiteAdminbool`json:"site_admin"`
}
Copy link

CopilotAIDec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

TheOutUser struct should useint64 for theID field instead ofstring to maintain consistency with the existingMinimalUser struct inminimal_types.go. The existing pattern usesID int64 \json:"id,omitempty"`throughout the codebase. The conversion logic inGetOrgMembers(line 344) andListOutsideCollaborators(line 423) should be updated fromfmt.Sprintf("%v", u.GetID())to justu.GetID()`.

Copilot uses AI. Check for mistakes.

funcGetOrgMembers(getClientGetClientFn,t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) {
returnmcp.NewTool("get_org_members",
mcp.WithDescription(t("TOOL_GET_ORG_MEMBERS_DESCRIPTION","Get member users of a specific organization. Returns a list of user objects with fields: login, id, avatar_url, type. Limited to organizations accessible with current credentials")),
Copy link

CopilotAIDec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The tool description claims to return "login, id, avatar_url, type" but the implementation also returnssite_admin. The description should be updated to includesite_admin in the list of returned fields for accuracy.

Suggested change
mcp.WithDescription(t("TOOL_GET_ORG_MEMBERS_DESCRIPTION","Get member users of a specific organization. Returns a list of user objects with fields: login, id, avatar_url, type. Limited to organizations accessible with current credentials")),
mcp.WithDescription(t("TOOL_GET_ORG_MEMBERS_DESCRIPTION","Get member users of a specific organization. Returns a list of user objects with fields: login, id, avatar_url, type, site_admin. Limited to organizations accessible with current credentials")),

Copilot uses AI. Check for mistakes.

funcListOutsideCollaborators(getClientGetClientFn,t translations.TranslationHelperFunc) (mcp.Tool, server.ToolHandlerFunc) {
returnmcp.NewTool("list_outside_collaborators",
mcp.WithDescription(t("TOOL_LIST_OUTSIDE_COLLABORATORS_DESCRIPTION","List all outside collaborators of an organization (users with access to organization repositories but not members).")),
Copy link

CopilotAIDec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The tool description should explicitly list all returned fields for consistency with other tools in the codebase. Consider adding "Returns a list of user objects with fields: login, id, avatar_url, type, site_admin" to match the pattern used inget_org_members and provide clarity about the response structure.

Suggested change
mcp.WithDescription(t("TOOL_LIST_OUTSIDE_COLLABORATORS_DESCRIPTION","List all outside collaborators of an organization (users with access to organization repositories but not members).")),
mcp.WithDescription(t("TOOL_LIST_OUTSIDE_COLLABORATORS_DESCRIPTION","List all outside collaborators of an organization (users with access to organization repositories but not members). Returns a list of user objects with fields: login, id, avatar_url, type, site_admin.")),

Copilot uses AI. Check for mistakes.
Comment on lines +340 to +349
varmembers []OutUser
for_,u:=rangeusers {
members=append(members,OutUser{
Login:u.GetLogin(),
ID:fmt.Sprintf("%v",u.GetID()),
AvatarURL:u.GetAvatarURL(),
Type:u.GetType(),
SiteAdmin:u.GetSiteAdmin(),
})
}
Copy link

CopilotAIDec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

The conversion logic from*github.User toOutUser is duplicated betweenGetOrgMembers (lines 340-349) andListOutsideCollaborators (lines 419-428). Consider extracting this into a helper function (e.g.,convertToOutUser) following the pattern used inminimal_types.go (seeconvertToMinimalUser) to improve maintainability and reduce code duplication.

Copilot uses AI. Check for mistakes.
Comment on lines +297 to +300
org:=params.Org
role:=params.Role
perPage:=params.PerPage
page:=params.Page
Copy link

CopilotAIDec 1, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

These intermediate variable assignments (lines 297-300) are unnecessary and reduce code clarity. The params struct fields (params.Org,params.Role, etc.) can be used directly throughout the function, which is the pattern followed by other tools in the codebase (e.g.,GetDiscussion andGetDiscussionComments indiscussions.go).

Copilot uses AI. Check for mistakes.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

1 participant

@cointem

[8]ページ先頭

©2009-2025 Movatter.jp