Skip to content

Tommy/(Bug-fix): adjust tool description to account for author in prompt #658

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

Conversation

tommaso-moro
Copy link
Contributor

@tommaso-moro tommaso-moro commented Jul 10, 2025

Overview

This PR fixes a buggy behaviour which occurs when the user uses the Github MCP to query PRs by author (e.g. by asking "show me my last 10 PRs in repo xyz") and the MCP uses the list_pull_requests tool, which does not support author-specific queries due to constraints in the Github API (see official API docs).

To fix this issue, this PR changes the list_pull_requests tool description to ensure that the search_pull_requests tool is selected when the user requests PRs by author.

Testing

This solution seems to work as expected across all models. The only caveat is that o4-mini sometimes doesn't seem to always use the get_me tool to get the user information before using the search_pull_requests tool (it does sometimes, as shown in the last screenshot). This behaviour should be investigated further but I don't believe it's specific to this PR.

Demo - Claude 4
Screenshot 2025-07-10 at 17 14 46

Demo - ChatGTP 4.1
Screenshot 2025-07-10 at 17 42 09

Demo - ChatGPT 4.0
Screenshot 2025-07-10 at 17 43 03

Demo - ChatGPT o4-mini (without get-me)
Screenshot 2025-07-10 at 17 54 01

Demo - ChatGPT o4-mini (with get-me)
Screenshot 2025-07-10 at 17 42 38

@tommaso-moro tommaso-moro marked this pull request as ready for review July 10, 2025 17:05
@Copilot Copilot AI review requested due to automatic review settings July 10, 2025 17:05
@tommaso-moro tommaso-moro requested a review from a team as a code owner July 10, 2025 17:05
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.

Pull Request Overview

This PR fixes a bug where the list_pull_requests tool was being selected for author-specific queries, despite not supporting author filtering due to GitHub API constraints. The fix updates the tool description to explicitly direct models to use search_pull_requests instead when an author is specified.

Key Changes:

  • Updated tool description to include explicit guidance against using this tool for author-specific queries
  • Removed an unnecessary blank line for code cleanliness
  • Updated corresponding test snapshot to reflect the description change

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/github/pullrequests.go Updated tool description to redirect author queries to search_pull_requests tool
pkg/github/toolsnaps/list_pull_requests.snap Updated test snapshot to match new tool description

@tommaso-moro tommaso-moro requested a review from LuluBeatson July 10, 2025 17:16
Copy link
Contributor

@LuluBeatson LuluBeatson left a comment

Choose a reason for hiding this comment

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

🙌 Nice one!

Copilot is even able to skip get_me and use author:@me in the search query!

Screenshot
List my last 5 PRs in github/github-mcp-server
image

@tommaso-moro tommaso-moro merged commit 42e5ce9 into github:main Jul 11, 2025
10 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