Skip to content

Add support for Repository Discussions #459

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

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open

Conversation

xcorail
Copy link

@xcorail xcorail commented May 31, 2025

Closes: #213

This PR adds support for repository discussions, with the following tools:

  • list_discussions
  • get_discussion
  • get_comments
  • list_discussion_categories

As there is no support for discussions in the GitHub go library, these tools use the GitHub GraphQL API

Alternatives

I considered using the REST API, but it's not officially supported yet and lacks some features such as category filtering and pagination, requiring post-treatments.

@Copilot Copilot AI review requested due to automatic review settings May 31, 2025 17:18
@xcorail xcorail requested a review from a team as a code owner May 31, 2025 17:18
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 adds support for GitHub Repository Discussions using the GraphQL API by introducing four new tools, updating the tool registry, and providing example scripts and documentation.

  • Introduces list_discussions, get_discussion, get_discussion_comments, and list_discussion_categories tools
  • Registers the new discussions toolset in pkg/github/tools.go
  • Implements GraphQL-based handlers in pkg/github/discussions.go with full test coverage and updates to README.md

Reviewed Changes

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

Show a summary per file
File Description
script/get-discussions Added example Bash script for calling list_discussions
pkg/github/tools.go Registered new “discussions” toolset
pkg/github/discussions.go Implemented handlers for discussions and categories
pkg/github/discussions_test.go Added tests covering listing, retrieval, and comments
README.md Documented the new discussions tools
Comments suppressed due to low confidence (2)

script/get-discussions:1

  • [nitpick] The script is named 'get-discussions' but invokes the 'list_discussions' tool; consider renaming it to 'list-discussions' for clarity.
#!/bin/bash

pkg/github/discussions_test.go:36

  • Current tests for ListDiscussions don’t cover pagination parameters ('first' and 'after') or sorting behavior; consider adding test cases for these conditions.
func Test_ListDiscussions(t *testing.T) {

@xcorail xcorail marked this pull request as draft May 31, 2025 18:16
@xcorail xcorail marked this pull request as ready for review May 31, 2025 18:44
Copy link
Author

@xcorail xcorail left a comment

Choose a reason for hiding this comment

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

Fix documentation to previous renaming

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.

Adding of GitHub Discussion support to the current GitHub MCP server.
1 participant