-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Tommy/expand-list-discussions-tool #690
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
base: main
Are you sure you want to change the base?
Tommy/expand-list-discussions-tool #690
Conversation
There was a problem hiding this 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 enhances the list_discussions
tool by adding ordering capabilities and expanding the discussion payload to include author information and updated timestamps. The changes enable users to sort discussions by creation or update date in ascending or descending order, while maintaining backward compatibility with existing functionality.
- Added
updatedAt
andauthor.login
fields to the discussion payload - Implemented ordering support with
orderBy
anddirection
parameters - Refactored GraphQL query handling to support optional parameters through pre-defined query variants
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 10 comments.
File | Description |
---|---|
pkg/github/discussions.go | Added new query struct types, ordering logic, and GraphQL query selection based on parameters |
pkg/github/discussions_test.go | Updated test data and added comprehensive test cases for ordering functionality |
README.md | Updated documentation to reflect new ordering parameters |
…ommaso-moro/github-mcp-server into tommy/expand-discussions-tools
Addresses #670
Overview
This PR expands the functionality of the
list_discussions
tool. It addsupdatedAt
andauthor.login
(i.e. username) fields to the discussions payload in thelist_discussions
toolupdated_at
andcreated_at
) and direction (ascending order, descending order)Refactoring
The PR includes extensive refactoring of the
list_discussions
tool to handle optional parameters in our graphql queries. This was needed because the githubv4 library requires GraphQL queries to be defined using Go struct tags that must be known at compile time, so we could not dynamically construct query strings at runtime based on user input.The changes made include
DiscussionFragment
struct to avoid field duplicationBasicNoOrder
: No optional parameters (uses GitHub API's defaults)BasicWithOrder
: Only ordering parametersWithCategoryNoOrder
: Only category filteringWithCategoryAndOrder
: Both category and orderingTests
I updated the tests in
discussions_test.go
to match the new queries, and to test the new ordering functionality with different sorting combinations.Demo
Simple "list discussions" prompt
Ordering: from most recently created to least recently created

Ordering: from least recently updated to most recently updated

Less explicit prompt: show me discussions from last 10 days

Ordering with weaker model (GPT-4o)

Note: this PR adds author data to the payload of the
list_discussions
tool but doesn't add support for filtering by author when listing discussions because that is not supported on the discussions field in the API, and it would need to be achieved in a separate search tool.