Skip to content

pkg/github: fix use of per page parameter #137

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

Merged
merged 3 commits into from
Apr 7, 2025

Conversation

AlexanderYastrebov
Copy link
Contributor

@AlexanderYastrebov AlexanderYastrebov commented Apr 6, 2025

Page size tool parameter names were changed to perPage within #90 while GitHub API uses per_page parameter name.

This change fixes overlooked inconsistencies.

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

@Copilot Copilot AI review requested due to automatic review settings April 6, 2025 17:01
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

@AlexanderYastrebov
Copy link
Contributor Author

Tested with code-insiders that list_commits now returns one item.

@@ -86,7 +86,7 @@ func searchCode(client *github.Client, t translations.TranslationHelperFunc) (to
mcp.Description("Sort order ('asc' or 'desc')"),
mcp.Enum("asc", "desc"),
),
mcp.WithNumber("per_page",
mcp.WithNumber("perPage",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not totally opposed to this, but the reason some of these existed in snake case form was because that's what the anthropic server exposed, and initially we just wanted to provide parity before moving forwards.

Obviously I introduced a few silly bugs in doing that last minute 😅

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, they actually use a mix:

IMO, if that's not crucial it would be better to revert all to per_page because that's what GitHub API uses and to reduce confusion.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, they actually use a mix

Right, so in #90 I changed the tool schemas to match the mix (but messed up the implementation).

I think for the moment let's keep this as perPage, and then we can talk about broader design principles at another time, looking at the entire API surface area. There's definitely a bit of tension between consistency within github-mcp-server, with the JSON-RPC envelope (all camel cased) with the GitHub API (mostly/all snake cased?).

I talked to the team and we're happy to get this in, I'm just going to take a closer look and maybe add some tests to avoid this in future. Thanks!

@williammartin
Copy link
Collaborator

Thanks for this, let me just run #137 (comment) by the others maintainers. I'd be in favour of it, because as seen, very easy to make mistakes.

SamMorrowDrums
SamMorrowDrums previously approved these changes Apr 7, 2025
@williammartin
Copy link
Collaborator

Hey @AlexanderYastrebov, I've pushed a couple of commits on top of your branch to hopefully avoid these kind of shenanigans in the future. Please have a glance and let me know if anything looks surprising to you. Thanks for your contribution!

Copy link
Collaborator

@SamMorrowDrums SamMorrowDrums left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! Thanks both, this is a nice improvement.

@AlexanderYastrebov
Copy link
Contributor Author

AlexanderYastrebov commented Apr 7, 2025

Please have a glance and let me know if anything looks surprising to you.

All good, thank you for the prompt review 🚀

Copy link
Collaborator

@juruen juruen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome! Thank you everyone for fixing this so quickly! 🚀

AlexanderYastrebov and others added 3 commits April 7, 2025 16:43
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 williammartin merged commit 0f9ef6e into github:main Apr 7, 2025
9 checks passed
@AlexanderYastrebov AlexanderYastrebov deleted the fix-per_page branch April 7, 2025 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

list_commits returns 30 commits despite perPage set to 1
4 participants