You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* add `SearchCommits` tool
* run test
* run script/generate-docs
* Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
* refactor(search_commits): share commit conversion, surface repo, tighten query docs
- Extract newMinimalCommitFromCore to share field mapping between
convertToMinimalCommit (RepositoryCommit) and the new
convertCommitResultToMinimalCommit (CommitResult), removing ~50
lines of duplicated logic from the search_commits handler.
- Add MinimalRepoRef and a search-only MinimalCommitSearchItem type
(embedding MinimalCommit) so cross-repo commit search results
identify the repo each commit came from. Keeping the field off
MinimalCommit avoids paying for a never-populated field on the
get_commit/list_commits output types.
- Rewrite the query description to teach the model the actual
commit-search qualifier surface (repo:/org:/user: scoping, author/
committer/date qualifiers, hash/tree/parent, merge:, is:public)
and reword the sort description to drop redundancy with the enum.
- Extend tests to assert the repository field is surfaced and to
cover commits with no resolved GitHub user (nil Author/Committer).
- Refresh README and toolsnap.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Sam Morrow <info@sam-morrow.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: README.md
+8Lines changed: 8 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1302,6 +1302,14 @@ The following sets of tools are available:
1302
1302
-`query`: Search query (GitHub code search REST). Implicit AND between terms; supports `OR`, `NOT`, and `"quoted phrase"` for exact match. Qualifiers: `repo:owner/repo`, `org:`, `user:`, `language:`, `path:dir` (prefix match), `filename:exact.ext`, `extension:`, `in:file`, `in:path`, `size:`, `is:archived`, `is:fork`. Max 256 chars. Examples: `WithContext language:go org:github`; `"package main" repo:o/r`; `func extension:go path:cmd repo:o/r`; `NOT TODO language:go repo:o/r`. (string, required)
1303
1303
-`sort`: Sort field ('indexed' only) (string, optional)
1304
1304
1305
+
-**search_commits** - Search commits
1306
+
-**Required OAuth Scopes**: `repo`
1307
+
-`order`: Sort order (string, optional)
1308
+
-`page`: Page number for pagination (min 1) (number, optional)
1309
+
-`perPage`: Results per page for pagination (min 1, max 100) (number, optional)
1310
+
-`query`: Commit search query (GitHub commit search REST). Searches commit messages on the default branch only. Scope the search with `repo:owner/repo`, `org:`, or `user:` (queries without a scope qualifier match across all of GitHub and are usually not what you want). Other qualifiers: `author:`, `committer:`, `author-name:`, `committer-name:`, `author-email:`, `committer-email:`, `author-date:`, `committer-date:` (supports `>`, `<`, `>=`, `<=`, and `YYYY-MM-DD..YYYY-MM-DD` ranges), `merge:true|false`, `hash:`, `tree:`, `parent:`, `is:public`. Examples: `repo:owner/repo fix panic`; `org:github author:defunkt committer-date:>=2024-01-01`; `"refactor cache" repo:o/r`; `hash:abc1234 repo:o/r`. (string, required)
1311
+
-`sort`: Sort by author or committer date (defaults to best match) (string, optional)
1312
+
1305
1313
-**search_repositories** - Search repositories
1306
1314
-**Required OAuth Scopes**: `repo`
1307
1315
-`minimal_output`: Return minimal repository information (default: true). When false, returns full GitHub API repository objects. (boolean, optional)
"description": "Search for commits across GitHub repositories using GitHub's commit search syntax. Useful for finding specific changes, authors, or messages across one or many repositories. Searches the default branch only.",
7
+
"inputSchema": {
8
+
"properties": {
9
+
"order": {
10
+
"description": "Sort order",
11
+
"enum": [
12
+
"asc",
13
+
"desc"
14
+
],
15
+
"type": "string"
16
+
},
17
+
"page": {
18
+
"description": "Page number for pagination (min 1)",
19
+
"minimum": 1,
20
+
"type": "number"
21
+
},
22
+
"perPage": {
23
+
"description": "Results per page for pagination (min 1, max 100)",
24
+
"maximum": 100,
25
+
"minimum": 1,
26
+
"type": "number"
27
+
},
28
+
"query": {
29
+
"description": "Commit search query (GitHub commit search REST). Searches commit messages on the default branch only. Scope the search with `repo:owner/repo`, `org:`, or `user:` (queries without a scope qualifier match across all of GitHub and are usually not what you want). Other qualifiers: `author:`, `committer:`, `author-name:`, `committer-name:`, `author-email:`, `committer-email:`, `author-date:`, `committer-date:` (supports `\u003e`, `\u003c`, `\u003e=`, `\u003c=`, and `YYYY-MM-DD..YYYY-MM-DD` ranges), `merge:true|false`, `hash:`, `tree:`, `parent:`, `is:public`. Examples: `repo:owner/repo fix panic`; `org:github author:defunkt committer-date:\u003e=2024-01-01`; `\"refactor cache\" repo:o/r`; `hash:abc1234 repo:o/r`.",
30
+
"type": "string"
31
+
},
32
+
"sort": {
33
+
"description": "Sort by author or committer date (defaults to best match)",
Description: "Commit search query (GitHub commit search REST). Searches commit messages on the default branch only. Scope the search with `repo:owner/repo`, `org:`, or `user:` (queries without a scope qualifier match across all of GitHub and are usually not what you want). Other qualifiers: `author:`, `committer:`, `author-name:`, `committer-name:`, `author-email:`, `committer-email:`, `author-date:`, `committer-date:` (supports `>`, `<`, `>=`, `<=`, and `YYYY-MM-DD..YYYY-MM-DD` ranges), `merge:true|false`, `hash:`, `tree:`, `parent:`, `is:public`. Examples: `repo:owner/repo fix panic`; `org:github author:defunkt committer-date:>=2024-01-01`; `\"refactor cache\" repo:o/r`; `hash:abc1234 repo:o/r`.",
490
+
},
491
+
"sort": {
492
+
Type: "string",
493
+
Description: "Sort by author or committer date (defaults to best match)",
494
+
Enum: []any{"author-date", "committer-date"},
495
+
},
496
+
"order": {
497
+
Type: "string",
498
+
Description: "Sort order",
499
+
Enum: []any{"asc", "desc"},
500
+
},
501
+
},
502
+
Required: []string{"query"},
503
+
}
504
+
WithPagination(schema)
505
+
506
+
returnNewTool(
507
+
ToolsetMetadataRepos,
508
+
mcp.Tool{
509
+
Name: "search_commits",
510
+
Description: t("TOOL_SEARCH_COMMITS_DESCRIPTION", "Search for commits across GitHub repositories using GitHub's commit search syntax. Useful for finding specific changes, authors, or messages across one or many repositories. Searches the default branch only."),
0 commit comments