-
Notifications
You must be signed in to change notification settings - Fork 2.8k
consolidating repos tools #1283
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?
Conversation
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 consolidates multiple repository operation tools into unified tools with method-based routing, reducing the total number of exposed tools while maintaining the same functionality.
- Consolidates commit operations (
get_commit,list_commits) intocommit_readwith "get" and "list" methods - Consolidates file write operations (
create_or_update_file,delete_file,push_files) intofile_writewith "create", "update", "delete", and "push_files" methods - Consolidates release/tag operations (
list_tags,get_tag,list_releases,get_latest_release,get_release_by_tag) intorelease_readwith corresponding methods
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/tools.go | Updates default toolset to use consolidated tools instead of individual operation tools |
| pkg/github/repositories.go | Implements consolidated tools with method dispatching and refactors individual operations into method handlers |
| pkg/github/repositories_test.go | Updates tests to use new consolidated tool names and adds method parameters to test cases |
| pkg/github/toolsnaps/*.snap | Adds snapshots for new consolidated tools and removes snapshots for deprecated individual tools |
| README.md | Updates documentation to reflect new consolidated tool structure |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
|
||
| func Test_ListCommits(t *testing.T) { | ||
| // Verify tool definition once | ||
| // Test for list method is covered in a separate test suite |
Copilot
AI
Oct 23, 2025
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 comment says 'Test for list method is covered in a separate test suite' but the list method tests are actually in the same file immediately following this comment (in Test_CommitRead_List). Update the comment to accurately reflect that the list method tests follow in this same file.
| // Test for list method is covered in a separate test suite | |
| // Tests for the list method follow in this file. |
| } | ||
|
|
||
| func Test_DeleteFile(t *testing.T) { | ||
| // Test_DeleteFile is removed as the delete_file tool has been consolidated into file_write |
Copilot
AI
Oct 23, 2025
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.
This comment suggests that tests for the delete file functionality were removed, but the actual delete file tests still exist below in the DeleteFileMethod function (lines 1345-1462). Either remove this misleading comment or clarify that the test function was renamed/reorganized rather than removed.
| // Test_DeleteFile is removed as the delete_file tool has been consolidated into file_write | |
| // The original Test_DeleteFile function was removed as the delete_file tool was consolidated into file_write. |
Summary
This PR consolidates repository-related tools in the GitHub MCP server, reducing tool count by 41% (17 → 10 tools) while maintaining all functionality. The refactoring improves semantic organization by grouping related operations under unified tools with
methodparameters and extracting toolsets into dedicated files following established patterns.Tool Consolidations
1. file_write (3 → 1 tool)
Consolidates all file modification operations:
create_or_update_file→file_writewithmethod: "create"ormethod: "update"delete_file→file_writewithmethod: "delete"push_files→file_writewithmethod: "push_files"Rationale: All three tools perform file modifications in a repository and share core parameters (
owner,repo,branch,message).2. commit_read (2 → 1 tool)
Consolidates commit read operations:
get_commit→commit_readwithmethod: "get"list_commits→commit_readwithmethod: "list"Rationale: Both tools read commit data from a repository and share the same required parameters (
owner,repo).3. tag_read (2 → 1 tool)
Consolidates Git tag operations:
list_tags→tag_readwithmethod: "list"get_tag→tag_readwithmethod: "get"Rationale: Both tools read Git tag data and share the same required parameters (
owner,repo).4. release_read (3 → 1 tool, moved to dedicated toolset)
Consolidates GitHub release operations into new
releasestoolset:list_releases→release_readwithmethod: "list"get_latest_release→release_readwithmethod: "get_latest"get_release_by_tag→release_readwithmethod: "get_by_tag"Rationale: Releases are semantically distinct from repository operations and warrant their own toolset, similar to
gists,discussions, etc.File Organization Improvements
New Dedicated Files Created
Following the established pattern used by other toolset groups (gists, discussions, etc.):
Releases (extracted from repositories.go):
pkg/github/releases.go- Tool definitions for new releases toolsetpkg/github/releases_test.go- Comprehensive testspkg/github/__toolsnaps__/release_read.snap- Tool snapshotStargazers (extracted from repositories.go):
pkg/github/stargazers.go- Tool definitions (list_starred_repositories, star_repository, unstar_repository)pkg/github/stargazers_test.go- Comprehensive testsTools NOT Consolidated
The following tools remain separate as they operate on distinct entities or lack shared parameters:
search_repositories,search_code- Different search use cases with distinct parametersget_file_contents- Requires special raw client handlinglist_branches- No natural pairing with other branch operationscreate_repository,fork_repository,create_branch- Operate on different entities (repos vs branches)Seperate
commit_readandtag_readinstead ofgit_readget_file_contentsor code/search tools; tags pair withrelease_readand version selection—low overlap in atomic retrieval needs.Benefits
✅ Better semantic organization: Releases now have dedicated toolset separate from repository operations
✅ Improved code maintainability: Related functionality grouped in dedicated files following established patterns
✅ Clearer tool discovery: Consolidated tools with method parameters are easier to understand and use
✅ Reduced tool count: 41% reduction (17 → 10 tools) in repos read/write operations
✅ No functional changes: Pure refactoring with comprehensive test coverage maintained
✅ Pattern consistency: Follows the same organizational pattern as gists, discussions, and other toolsets
Testing
All existing tests have been maintained and relocated to dedicated test files. Tool snapshots have been updated to reflect the new consolidated structure. No functional behavior has been changed.