Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add create_discussion tool to discussions toolset#1519

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
furkankoykiran wants to merge1 commit intogithub:main
base:main
Choose a base branch
Loading
fromfurkankoykiran:feature/add-create-discussion-tool

Conversation

@furkankoykiran
Copy link

Closes#1517

This PR adds a newcreate_discussion tool to the discussions toolset, enabling programmatic creation of GitHub Discussions through the MCP server.

Changes

  • AddedCreateDiscussion function inpkg/github/discussions.go using GraphQL mutation
  • Implemented comprehensive unit tests covering success and error scenarios
  • Updated discussions toolset to include the new write tool
  • Generated toolsnap for schema validation

Testing

  • All existing tests pass
  • New tests cover:
    • Successful discussion creation
    • Organization-level discussions
    • Missing parameter validation
    • Repository and category not found errors
  • Linter passes with no issues
  • Documentation generated viascript/generate-docs

The tool follows existing patterns in the codebase and integrates cleanly with the current discussions toolset structure.

Implements GraphQL mutation for creating discussions programmatically.Enables AI agents to create discussions in repositories and organizations.Closesgithub#1517
@furkankoykiranfurkankoykiran requested a review froma team as acode ownerDecember 2, 2025 00:39
CopilotAI review requested due to automatic review settingsDecember 2, 2025 00:39
Copilot finished reviewing on behalf offurkankoykiranDecember 2, 2025 00:42
Copy link
Contributor

CopilotAI 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 a newcreate_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:

  • NewCreateDiscussion function 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
FileDescription
pkg/github/discussions.goImplements theCreateDiscussion function with GraphQL mutation, parameter validation, and error handling. Supports both repository-level and organization-level discussions (via.github repo).
pkg/github/tools.goRegistersCreateDiscussion as a write tool in the discussions toolset.
pkg/github/discussions_test.goAdds comprehensive unit tests covering successful creation, organization-level discussions, missing parameters, and error scenarios (repository/category not found).
pkg/github/toolsnaps/create_discussion.snapTool schema snapshot for API validation (needs regeneration after fixing ReadOnlyHint issue).
README.mdUpdates tool documentation with the newcreate_discussion tool and its parameters.
docs/remote-server.mdChanges "Default" to "all" in the toolset table (appears unrelated to this PR).

{
"annotations": {
"title":"Create discussion"
},
Copy link

CopilotAIDec 2, 2025

Choose a reason for hiding this comment

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

The toolsnap is missing thereadOnlyHint field that should be set tofalse for write operations. This needs to be regenerated after addingReadOnlyHint: false to the tool annotations indiscussions.go. RunUPDATE_TOOLSNAPS=true go test ./... to update the snapshot after fixing the code.

Suggested change
},
},
"readOnlyHint":false,

Copilot uses AI. Check for mistakes.
| Name| Description| API URL| 1-Click Install (VS Code)| Read-only Link| 1-Click Read-only Install (VS Code)|
|----------------|--------------------------------------------------|-------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|Default|["Default" toolset](../README.md#default-toolset)|https://api.githubcopilot.com/mcp/|[Install](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2F%22%7D)|[read-only](https://api.githubcopilot.com/mcp/readonly)|[Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Freadonly%22%7D)|
|all|All available GitHub MCP tools|https://api.githubcopilot.com/mcp/|[Install](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2F%22%7D)|[read-only](https://api.githubcopilot.com/mcp/readonly)|[Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Freadonly%22%7D)|
Copy link

CopilotAIDec 2, 2025

Choose a reason for hiding this comment

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

This change from "Default" to "all" appears to be unrelated to adding thecreate_discussion tool. If this is an intentional update to the remote server documentation, it should be in a separate commit or PR. Otherwise, this line should remain as "Default" to match line 91 which still references "Default toolset".

Suggested change
|all| All available GitHub MCP tools|https://api.githubcopilot.com/mcp/|[Install](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2F%22%7D)|[read-only](https://api.githubcopilot.com/mcp/readonly)|[Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Freadonly%22%7D)|
|Default| All available GitHub MCP tools|https://api.githubcopilot.com/mcp/|[Install](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2F%22%7D)|[read-only](https://api.githubcopilot.com/mcp/readonly)|[Install read-only](https://insiders.vscode.dev/redirect/mcp/install?name=github&config=%7B%22type%22%3A%20%22http%22%2C%22url%22%3A%20%22https%3A%2F%2Fapi.githubcopilot.com%2Fmcp%2Freadonly%22%7D)|

Copilot uses AI. Check for mistakes.
Name:"create_discussion",
Description:t("TOOL_CREATE_DISCUSSION_DESCRIPTION","Create a new discussion in a repository or organisation."),
Annotations:&mcp.ToolAnnotations{
Title:t("TOOL_CREATE_DISCUSSION_USER_TITLE","Create discussion"),
Copy link

CopilotAIDec 2, 2025

Choose a reason for hiding this comment

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

MissingReadOnlyHint: false annotation. Write operations likecreate_discussion should explicitly setReadOnlyHint: false to indicate they perform mutations. This is consistent with other write tools in the codebase (seecreate_gist,label_write,create_issue, etc.).

Suggested change
Title:t("TOOL_CREATE_DISCUSSION_USER_TITLE","Create discussion"),
Title:t("TOOL_CREATE_DISCUSSION_USER_TITLE","Create discussion"),
ReadOnlyHint:mcp.BoolPtr(false),

Copilot uses AI. Check for mistakes.
Comment on lines +820 to +831
require.NoError(t,toolsnaps.Test(toolDef.Name,toolDef))

assert.Equal(t,"create_discussion",toolDef.Name)
assert.NotEmpty(t,toolDef.Description)
schema,ok:=toolDef.InputSchema.(*jsonschema.Schema)
require.True(t,ok,"InputSchema should be *jsonschema.Schema")
assert.Contains(t,schema.Properties,"owner")
assert.Contains(t,schema.Properties,"repo")
assert.Contains(t,schema.Properties,"categoryId")
assert.Contains(t,schema.Properties,"title")
assert.Contains(t,schema.Properties,"body")
assert.ElementsMatch(t,schema.Required, []string{"owner","categoryId","title","body"})
Copy link

CopilotAIDec 2, 2025

Choose a reason for hiding this comment

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

The test should verify thatReadOnlyHint isfalse for the write tool, similar to how other write tool tests do (e.g.,create_gist,label_write). Add:

assert.False(t,toolDef.Annotations.ReadOnlyHint,"create_discussion tool should not be read-only")

Copilot uses AI. Check for mistakes.
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add create_discussion tool to discussions toolset

1 participant

@furkankoykiran

[8]ページ先頭

©2009-2025 Movatter.jp