Skip to content

Conversation

@jack-arturo
Copy link

This adds a new tool to the repos toolset that enables managing repository collaborators via the GitHub API. The tool supports:

  • Adding new collaborators with an invitation
  • Setting permission levels (pull, triage, push, maintain, admin)
  • Handling cases where the user already has access
  • Proper error handling for API failures

The implementation follows the existing patterns in the codebase and includes comprehensive tests with mocked HTTP responses for all main scenarios.

Closes #1541.

Closes:

This adds a new tool to the repos toolset that enables managing repository
collaborators via the GitHub API. The tool supports:

- Adding new collaborators with an invitation
- Setting permission levels (pull, triage, push, maintain, admin)
- Handling cases where the user already has access
- Proper error handling for API failures

The implementation follows the existing patterns in the codebase and includes
comprehensive tests with mocked HTTP responses for all main scenarios.
Copilot AI review requested due to automatic review settings December 5, 2025 23:50
@jack-arturo jack-arturo requested a review from a team as a code owner December 5, 2025 23:50
Copy link
Contributor

Copilot AI 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 a new add_repository_collaborator tool to the repositories toolset, enabling AI agents to manage repository collaborators programmatically through the GitHub API. The implementation follows established patterns in the codebase and includes comprehensive testing.

  • Adds a new MCP tool for adding collaborators to GitHub repositories with configurable permission levels
  • Handles multiple API response scenarios including new invitations, existing collaborators, and error cases
  • Includes complete test coverage with mocked HTTP responses

Reviewed changes

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

Show a summary per file
File Description
pkg/github/tools.go Registers the new AddRepositoryCollaborator tool in the write tools section of the repos toolset
pkg/github/repositories.go Implements the complete tool definition and handler with validation, error handling, and status code interpretation for three response types (created, accepted, no-content)
pkg/github/repositories_test.go Adds comprehensive table-driven tests covering successful invitation, existing collaborator, and API error scenarios with proper mock expectations
pkg/github/toolsnaps/add_repository_collaborator.snap Tool schema snapshot documenting the API surface for the new tool
README.md Updates tool documentation with parameter descriptions for the new collaborator management functionality

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add add_repository_collaborator tool for managing repository access

1 participant