feat: Add search commit tool#2284
Conversation
marknilsn
left a comment
There was a problem hiding this comment.
Nice addition. search_commits feels like a real gap-filler between list_commits and broader search, and the implementation/result shape look reasonable to me. Non-blocking thought: we may eventually want a short note about commit-search query expectations or caveats, but I don’t see that as a blocker here.
There was a problem hiding this comment.
Pull request overview
Adds a new MCP tool to the GitHub MCP Server for searching commits via GitHub’s commit search API, filling a capability gap vs. list_commits.
Changes:
- Added
search_commitstool implementation (SearchCommits) including minimal response shaping. - Registered the new tool in the global tool inventory.
- Added tests and a new toolsnap snapshot for the tool schema.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/tools.go | Registers SearchCommits in AllTools so it’s exposed by the server. |
| pkg/github/search.go | Implements the new search_commits tool and maps GitHub API results to minimal output. |
| pkg/github/minimal_types.go | Adds MinimalSearchCommitsResult output type. |
| pkg/github/search_test.go | Adds schema/toolsnap verification and handler behavior tests for search_commits. |
| pkg/github/helper_test.go | Adds mock route constant for /search/commits. |
| pkg/github/toolsnaps/search_commits.snap | Adds schema snapshot for the new tool. |
There was a problem hiding this comment.
Pull request overview
Adds a new search_commits MCP tool to the GitHub MCP Server, enabling commit discovery via GitHub’s commit search syntax and returning a trimmed/minimal result payload.
Changes:
- Implemented
SearchCommitstool handler and response shaping intoMinimalSearchCommitsResult. - Registered
search_commitsin the overall tool inventory. - Added unit tests + toolsnap snapshot, and updated README tool documentation.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/tools.go | Registers the new SearchCommits tool in the server tool list. |
| pkg/github/search.go | Implements the search_commits tool schema + handler calling GitHub Search Commits API and emitting minimal output. |
| pkg/github/minimal_types.go | Adds MinimalSearchCommitsResult output type for commit search responses. |
| pkg/github/search_test.go | Adds toolsnap verification and handler behavior tests for search_commits. |
| pkg/github/helper_test.go | Adds the /search/commits endpoint constant used by HTTP mocking helpers. |
| pkg/github/toolsnaps/search_commits.snap | New snapshot for the search_commits tool schema. |
| README.md | Documents the new tool in the generated tools section. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
Adds a new search_commits MCP tool to the GitHub MCP server, enabling commit searches via GitHub’s commit search syntax and returning a trimmed, structured result.
Changes:
- Implemented
SearchCommitstool handler usingclient.Search.Commits(...)with pagination support. - Added
MinimalSearchCommitsResultoutput type and associated unit tests + toolsnap snapshot. - Registered the tool in the global tool inventory and documented it in the README.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/tools.go | Registers SearchCommits in AllTools so it’s available to the server/toolsets/docs generator. |
| pkg/github/search.go | Implements the search_commits tool schema and handler logic. |
| pkg/github/minimal_types.go | Adds MinimalSearchCommitsResult trimmed output struct for commit search responses. |
| pkg/github/search_test.go | Adds tool snapshot + behavior tests (success/error) for search_commits. |
| pkg/github/helper_test.go | Adds mocked endpoint constant for /search/commits to support tests. |
| pkg/github/toolsnaps/search_commits.snap | New toolsnap capturing the tool’s schema/metadata for regression protection. |
| README.md | Documents the new tool and its parameters/scopes in the generated tools section. |
|
@SamMorrowDrums, Can you take a look? |


Summary
Added a new search_commits tool to the GitHub MCP server, allowing users and LLMs to search for commits across repositories using specialized GitHub search syntax
Why
This provides a missing capability for high-impact commit discovery and debugging that isn't possible with the existing list_commits tool
Fixes #2283
What changed
SearchCommitsMinimalSearchCommitsResultstructpkg/github/tools.goMCP impact
Prompts tested (tool changes only)
Security / limits
Tool renaming
deprecated_tool_aliases.goNote: if you're renaming tools, you must add the tool aliases. For more information on how to do so, please refer to the official docs.
Lint & tests
./script/lint./script/testDocs