Skip to content

Conversation

beccccaboo
Copy link
Contributor

@beccccaboo beccccaboo commented Aug 15, 2025

Closes #825
Closes #876

This PR adds a new list_repository_contributors tool to the GitHub MCP Server.

What's New (for #825)

  • New Tool: list_repository_contributors - Lists contributors for a GitHub repository
  • API Endpoint: Implements GET /repos/{owner}/{repo}/contributors REST API

What's New (for #876)
Refer the correct installation index in README.md

@beccccaboo beccccaboo requested a review from a team as a code owner August 15, 2025 19:46
@Copilot Copilot AI review requested due to automatic review settings August 15, 2025 19:46
Copilot

This comment was marked as outdated.

@beccccaboo beccccaboo changed the title Feature/add list repository contributors feat: add list repository contributors and update readme Aug 15, 2025
beccccaboo and others added 2 commits August 15, 2025 12:55
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Copilot Copilot AI review requested due to automatic review settings September 4, 2025 04:48
Copy link
Contributor

@Copilot 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 GitHub API tool for listing repository contributors and fixes a README reference. The main focus is implementing the list_repository_contributors tool that interfaces with GitHub's REST API to retrieve contributor information for repositories.

  • Implements a new list_repository_contributors tool with pagination support
  • Adds comprehensive test coverage for the new functionality
  • Updates README documentation to include the new tool
  • Corrects a README reference issue

Reviewed Changes

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

Show a summary per file
File Description
script/list-repository-contributors Test script for the new contributors tool
pkg/github/tools.go Registers the new tool in the default toolset
pkg/github/repositories_test.go Comprehensive test cases for the contributors functionality
pkg/github/repositories.go Core implementation of the contributors listing tool
pkg/github/toolsnaps/list_repository_contributors.snap Tool schema snapshot for testing
README.md Documentation update for the new tool

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +256 to +263
if resp.StatusCode != http.StatusOK {
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response body: %w", err)
}
return mcp.NewToolResultError(fmt.Sprintf("failed to list contributors: %s", string(body))), nil
}

Copy link
Preview

Copilot AI Sep 4, 2025

Choose a reason for hiding this comment

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

The status code check and error handling is redundant since the GitHub client API call already handles HTTP errors. This pattern differs from other similar functions in the codebase like ListCommits and ListBranches where the status check is performed after confirming no API error occurred. Consider removing lines 256-262 to maintain consistency.

Suggested change
if resp.StatusCode != http.StatusOK {
body, err := io.ReadAll(resp.Body)
if err != nil {
return nil, fmt.Errorf("failed to read response body: %w", err)
}
return mcp.NewToolResultError(fmt.Sprintf("failed to list contributors: %s", string(body))), nil
}

Copilot uses AI. Check for mistakes.

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 support for list_repository_contributors 404 error
1 participant