Skip to content

Commit f88456f

Browse files
authored
Update list commits tool description (github#629)
1 parent 6043bec commit f88456f

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ export GITHUB_MCP_TOOL_ADD_ISSUE_COMMENT_DESCRIPTION="an alternative description
903903
- `page`: Page number for pagination (min 1) (number, optional)
904904
- `perPage`: Results per page for pagination (min 1, max 100) (number, optional)
905905
- `repo`: Repository name (string, required)
906-
- `sha`: SHA or Branch name (string, optional)
906+
- `sha`: The commit SHA, branch name, or tag name to list commits from. If not specified, defaults to the repository's default branch. (string, optional)
907907

908908
- **list_tags** - List tags
909909
- `owner`: Repository owner (string, required)

pkg/github/__toolsnaps__/list_commits.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"title": "List commits",
44
"readOnlyHint": true
55
},
6-
"description": "Get list of commits of a branch in a GitHub repository",
6+
"description": "Get list of commits of a branch in a GitHub repository. Returns at least 30 results per page by default, but can return more if specified using the perPage parameter (up to 100).",
77
"inputSchema": {
88
"properties": {
99
"author": {
@@ -30,7 +30,7 @@
3030
"type": "string"
3131
},
3232
"sha": {
33-
"description": "SHA or Branch name",
33+
"description": "The commit SHA, branch name, or tag name to list commits from. If not specified, defaults to the repository's default branch.",
3434
"type": "string"
3535
}
3636
},

pkg/github/repositories.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ func GetCommit(getClient GetClientFn, t translations.TranslationHelperFunc) (too
9797
// ListCommits creates a tool to get commits of a branch in a repository.
9898
func ListCommits(getClient GetClientFn, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
9999
return mcp.NewTool("list_commits",
100-
mcp.WithDescription(t("TOOL_LIST_COMMITS_DESCRIPTION", "Get list of commits of a branch in a GitHub repository")),
100+
mcp.WithDescription(t("TOOL_LIST_COMMITS_DESCRIPTION", "Get list of commits of a branch in a GitHub repository. Returns at least 30 results per page by default, but can return more if specified using the perPage parameter (up to 100).")),
101101
mcp.WithToolAnnotation(mcp.ToolAnnotation{
102102
Title: t("TOOL_LIST_COMMITS_USER_TITLE", "List commits"),
103103
ReadOnlyHint: ToBoolPtr(true),
@@ -111,7 +111,7 @@ func ListCommits(getClient GetClientFn, t translations.TranslationHelperFunc) (t
111111
mcp.Description("Repository name"),
112112
),
113113
mcp.WithString("sha",
114-
mcp.Description("SHA or Branch name"),
114+
mcp.Description("The commit SHA, branch name, or tag name to list commits from. If not specified, defaults to the repository's default branch."),
115115
),
116116
mcp.WithString("author",
117117
mcp.Description("Author username or email address"),
@@ -139,13 +139,17 @@ func ListCommits(getClient GetClientFn, t translations.TranslationHelperFunc) (t
139139
if err != nil {
140140
return mcp.NewToolResultError(err.Error()), nil
141141
}
142-
142+
// Set default perPage to 30 if not provided
143+
perPage := pagination.perPage
144+
if perPage == 0 {
145+
perPage = 30
146+
}
143147
opts := &github.CommitsListOptions{
144148
SHA: sha,
145149
Author: author,
146150
ListOptions: github.ListOptions{
147151
Page: pagination.page,
148-
PerPage: pagination.perPage,
152+
PerPage: perPage,
149153
},
150154
}
151155

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy