Add create_discussion tool to discussions toolset#1519
Add create_discussion tool to discussions toolset#1519furkankoykiran wants to merge 1 commit intogithub:mainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a new create_discussion tool to enable programmatic creation of GitHub Discussions through the MCP server. The implementation uses GraphQL mutations and follows existing patterns in the codebase for write operations.
Key changes:
- New
CreateDiscussionfunction using GraphQL mutation API - Registration of the tool in the discussions toolset as a write tool
- Comprehensive unit tests covering various scenarios
- Generated toolsnap for API schema validation
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/discussions.go | Implements the CreateDiscussion function with GraphQL mutation, parameter validation, and error handling. Supports both repository-level and organization-level discussions (via .github repo). |
| pkg/github/tools.go | Registers CreateDiscussion as a write tool in the discussions toolset. |
| pkg/github/discussions_test.go | Adds comprehensive unit tests covering successful creation, organization-level discussions, missing parameters, and error scenarios (repository/category not found). |
| pkg/github/toolsnaps/create_discussion.snap | Tool schema snapshot for API validation (needs regeneration after fixing ReadOnlyHint issue). |
| README.md | Updates tool documentation with the new create_discussion tool and its parameters. |
| docs/remote-server.md | Changes "Default" to "all" in the toolset table (appears unrelated to this PR). |
This PR adds a new CreateDiscussion tool that allows users to create discussions in a GitHub repository or at the organisation level. Changes: - Add CreateDiscussion function with new NewTool() pattern in discussions.go - Add getDiscussionRepositoryID helper function - Add comprehensive unit tests in discussions_test.go - Add toolsnap for create_discussion tool
e02cd14 to
e854a95
Compare
|
Hey @SamMorrowDrums 👋 Just wanted to give a heads up - I've rebased this PR on latest main to fix the conflicts that came up after all the recent refactoring. Had to reimplement the whole thing using the new Would appreciate a review when you get a chance! Let me know if anything needs adjustment. |
Closes #1517
This PR adds a new
create_discussiontool to the discussions toolset, enabling programmatic creation of GitHub Discussions through the MCP server.Changes
CreateDiscussionfunction inpkg/github/discussions.gousing GraphQL mutationTesting
script/generate-docsThe tool follows existing patterns in the codebase and integrates cleanly with the current discussions toolset structure.