Skip to content
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

feat: Add update_pull_request tool #122

Merged
merged 9 commits into from
Apr 9, 2025

Conversation

monotykamary
Copy link
Contributor

@monotykamary monotykamary commented Apr 5, 2025

This pull request introduces the update_pull_request tool to the GitHub MCP server.

Changes:

  • Added the UpdatePullRequest function in pkg/github/pullrequests.go to define the tool and its handler.
  • Added the OptionalParamOK helper function in pkg/github/server.go.
  • Registered the new tool in pkg/github/server.go.
  • Added unit tests for the UpdatePullRequest tool in pkg/github/pullrequests_test.go.
  • Fixed test failures related to request body expectations for the base field during testing.

The new tool allows users to update the following fields of an existing pull request:

  • title
  • body
  • state (open/closed)
  • base branch
  • maintainer_can_modify flag

This was updated through the update_pull_request tool GitHub MCP server (^6).

@Copilot Copilot bot review requested due to automatic review settings April 5, 2025 08:00
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 3 out of 3 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (2)

pkg/github/pullrequests.go:156

  • The error message returned for missing update parameters includes a trailing period. Consider unifying the error message text (e.g. 'No update parameters provided') to match test expectations and ensure consistency.
if !updateNeeded {

pkg/github/server.go:129

  • [nitpick] The error message in the optionalParamOk helper could be clarified by explicitly stating the expected and actual types, making debugging easier when a parameter has an unexpected type.
if !ok {

@monotykamary
Copy link
Contributor Author

image

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.

Thank you so much for your PR! ❤️

I added a few comments, mainly to the new optionalParamOk function.

I'm not super hyped about the name, but naming is hard :)

In general, this tool has shown that the current optionalParam falls short when you actually want to know whether the parameter actually exists.

This is probably out of the scope for this PR, but I'm going to open an issue to discuss how we can handle optional parameters better. I have the feeling that it might make sense that the optionalParam to always return whether the param was passed. But again, that might be a separate discussion.

@monotykamary monotykamary requested a review from juruen April 5, 2025 08:54
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.

@monotykamary thank you for your changes, just one more thing, would you mind updating the README to list the new tool?

@monotykamary monotykamary requested a review from juruen April 5, 2025 17:06
@monotykamary
Copy link
Contributor Author

Oh right, forgot about that part. Should be up 👍

juruen
juruen previously approved these changes Apr 6, 2025
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.

LGTM! 🚀

Thank you so much for your contribution!

@juruen
Copy link
Collaborator

juruen commented Apr 8, 2025

@monotykamary can you please update your branch with latest main, and we we'll be good to merge!

@monotykamary
Copy link
Contributor Author

@juruen I've updated it to follow the newer named export convention, should be good 👍

@monotykamary monotykamary requested a review from juruen April 8, 2025 08:41
@juruen
Copy link
Collaborator

juruen commented Apr 8, 2025

@monotykamary I can't update your branch because you probably set maintainer_can_modify to false, so you need to do it before we can merge it.

@monotykamary
Copy link
Contributor Author

Aha my bad. @juruen should be set. This PR was made by the MCP server, should probably note somewhere to add mcp.DefaultBool(true), to allow maintainer edits by default.

@juruen
Copy link
Collaborator

juruen commented Apr 9, 2025

Aha my bad. @juruen should be set. This PR was made by the MCP server

I figured that as well 😄

should probably note somewhere to add mcp.DefaultBool(true), to allow maintainer edits by default.

Agreed!

@juruen juruen merged commit 56c1fce into github:main Apr 9, 2025
9 checks passed
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.

2 participants