-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat: add list repository contributors and update readme #893
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: add list repository contributors and update readme #893
Conversation
This reverts commit ece480e.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this 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.
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 | ||
} | ||
|
There was a problem hiding this comment.
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.
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.
Closes #825
Closes #876
This PR adds a new
list_repository_contributors
tool to the GitHub MCP Server.What's New (for #825)
What's New (for #876)
Refer the correct installation index in README.md