Skip to content

list_commits returns 30 commits despite perPage set to 1 #136

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

Closed
bocytko opened this issue Apr 6, 2025 · 4 comments · Fixed by #137
Closed

list_commits returns 30 commits despite perPage set to 1 #136

bocytko opened this issue Apr 6, 2025 · 4 comments · Fixed by #137
Labels
bug Something isn't working

Comments

@bocytko
Copy link

bocytko commented Apr 6, 2025

Describe the bug

list_commits does not interpret the perPage parameter correctly and returns 30 commits (default).

list_commits({
  "owner": "X",
  "repo": "Y",
  "perPage": 1
})

Maybe it's a mismatch between

mcp.WithNumber("perPage",
and
perPage, err := optionalIntParamWithDefault(request, "per_page", 30)
as a result of changes from #90.

Affected version

Please run docker run -i --rm ghcr.io/github/github-mcp-server ./github-mcp-server --version and paste the output below

server version v0.1.0 (b89336793c5bc9b9abdd5100d876babbc1031f5d) 2025-04-04T15:38:21Z

Steps to reproduce the behavior

  1. Agent config:
    agent = Agent(
        name="Assistant",
        instructions=f"Answer questions about Git repositories.",
        mcp_servers=[mcp_server],
    )
  1. User input: Summarize the last change in the repository X/Y
  2. LLM translated the input into the function call:
list_commits({
  "owner": "X",
  "repo": "Y",
  "perPage": 1
})
  1. The output from the tool call contains 30 commits, which is the default set in
    perPage, err := optionalIntParamWithDefault(request, "per_page", 30)

Expected vs actual behavior

The perPage parameter should be correctly respected.

Logs

$ wc -c output.json
  179574 output.json

$ cat output.json | jq -r .text | jq '.[].sha' | wc -l
      30
@bocytko bocytko added the bug Something isn't working label Apr 6, 2025
@vanshavenger
Copy link

It should be perPage, A similar PR was merged yesterday, Same issue in search_repositories

@AlexanderYastrebov
Copy link
Contributor

A similar PR was merged yesterday, Same issue in search_repositories

#129

@vanshavenger
Copy link

A similar PR was merged yesterday, Same issue in search_repositories

#129

Yess
, ig there can be more references and One single PR can resolve it

@vanshavenger
Copy link

@williammartin
for all the such cases we should move it to "perPage" (Golang Convenction)
and Maka const file for these keywords

AlexanderYastrebov added a commit to AlexanderYastrebov/github-mcp-server that referenced this issue Apr 6, 2025
Page site tool parameter names were changed to `perPage` within github#129
while GitHub API uses `per_page` parameter name.

This change fixes overlooked inconsistencies.

Follow up on github#129
Fixes github#136

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/github-mcp-server that referenced this issue Apr 6, 2025
Page size tool parameter names were changed to `perPage` within github#129
while GitHub API uses `per_page` parameter name.

This change fixes overlooked inconsistencies.

Follow up on github#129
Fixes github#136

Signed-off-by: Alexander Yastrebov <[email protected]>
AlexanderYastrebov added a commit to AlexanderYastrebov/github-mcp-server that referenced this issue Apr 6, 2025
Page size tool parameter names were changed to `perPage` within github#90
while GitHub API uses `per_page` parameter name.

This change fixes overlooked inconsistencies.

Follow up on github#90
Follow up on github#129
Fixes github#136

Signed-off-by: Alexander Yastrebov <[email protected]>
williammartin pushed a commit to AlexanderYastrebov/github-mcp-server that referenced this issue Apr 7, 2025
Page size tool parameter names were changed to `perPage` within github#90
while GitHub API uses `per_page` parameter name.

This change fixes overlooked inconsistencies.

Follow up on github#90
Follow up on github#129
Fixes github#136

Signed-off-by: Alexander Yastrebov <[email protected]>
manian0430 pushed a commit to ChrisLally/github-mcp-server that referenced this issue Apr 12, 2025
Page size tool parameter names were changed to `perPage` within github#90
while GitHub API uses `per_page` parameter name.

This change fixes overlooked inconsistencies.

Follow up on github#90
Follow up on github#129
Fixes github#136

Signed-off-by: Alexander Yastrebov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants