Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"annotations": {
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": false,
"title": "Add review comment to the requester's latest pending pull request review"
},
Expand Down
1 change: 1 addition & 0 deletions pkg/github/__toolsnaps__/add_issue_comment.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"annotations": {
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": false,
"title": "Add comment to issue or pull request"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"annotations": {
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": false,
"title": "Add reply to pull request comment"
},
Expand Down
1 change: 1 addition & 0 deletions pkg/github/__toolsnaps__/discussion_comment_write.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"annotations": {
"destructiveHint": true,
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": false,
"title": "Manage discussion comments"
},
Expand Down
1 change: 1 addition & 0 deletions pkg/github/__toolsnaps__/get_discussion.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"annotations": {
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": true,
"title": "Get discussion"
},
Expand Down
1 change: 1 addition & 0 deletions pkg/github/__toolsnaps__/get_discussion_comments.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"annotations": {
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": true,
"title": "Get discussion comments"
},
Expand Down
1 change: 1 addition & 0 deletions pkg/github/__toolsnaps__/issue_read.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"annotations": {
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": true,
"title": "Get issue details"
},
Expand Down
1 change: 1 addition & 0 deletions pkg/github/__toolsnaps__/issue_write.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
},
"annotations": {
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": false,
"title": "Create or update issue/pull request"
},
Expand Down
1 change: 1 addition & 0 deletions pkg/github/__toolsnaps__/pull_request_read.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"annotations": {
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": true,
"title": "Get details for a single pull request"
},
Expand Down
1 change: 1 addition & 0 deletions pkg/github/__toolsnaps__/pull_request_review_write.snap
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"annotations": {
"idempotentHint": false,
"openWorldHint": true,
"readOnlyHint": false,
"title": "Write operations (create, submit, delete) on pull request reviews"
},
Expand Down
11 changes: 7 additions & 4 deletions pkg/github/discussions.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,8 +290,9 @@ func GetDiscussion(t translations.TranslationHelperFunc) inventory.ServerTool {
Name: "get_discussion",
Description: t("TOOL_GET_DISCUSSION_DESCRIPTION", "Get a specific discussion by ID"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_GET_DISCUSSION_USER_TITLE", "Get discussion"),
ReadOnlyHint: true,
Title: t("TOOL_GET_DISCUSSION_USER_TITLE", "Get discussion"),
ReadOnlyHint: true,
OpenWorldHint: jsonschema.Ptr(true),
},
InputSchema: &jsonschema.Schema{
Type: "object",
Expand Down Expand Up @@ -398,8 +399,9 @@ func GetDiscussionComments(t translations.TranslationHelperFunc) inventory.Serve
Name: "get_discussion_comments",
Description: t("TOOL_GET_DISCUSSION_COMMENTS_DESCRIPTION", "Get comments from a discussion"),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_GET_DISCUSSION_COMMENTS_USER_TITLE", "Get discussion comments"),
ReadOnlyHint: true,
Title: t("TOOL_GET_DISCUSSION_COMMENTS_USER_TITLE", "Get discussion comments"),
ReadOnlyHint: true,
OpenWorldHint: jsonschema.Ptr(true),
},
InputSchema: WithCursorPagination(&jsonschema.Schema{
Type: "object",
Expand Down Expand Up @@ -598,6 +600,7 @@ Supports adding top-level comments, replying to existing comments, updating comm
Title: t("TOOL_DISCUSSION_COMMENT_WRITE_USER_TITLE", "Manage discussion comments"),
ReadOnlyHint: false,
DestructiveHint: jsonschema.Ptr(true),
OpenWorldHint: jsonschema.Ptr(true),
},
InputSchema: &jsonschema.Schema{
Type: "object",
Expand Down
8 changes: 8 additions & 0 deletions pkg/github/discussions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,9 @@ func Test_GetDiscussion(t *testing.T) {

assert.Equal(t, "get_discussion", tool.Name)
assert.NotEmpty(t, tool.Description)
assert.True(t, tool.Annotations.ReadOnlyHint, "get_discussion should be read-only")
require.NotNil(t, tool.Annotations.OpenWorldHint)
assert.True(t, *tool.Annotations.OpenWorldHint, "get_discussion returns untrusted discussion UGC")
schema, ok := tool.InputSchema.(*jsonschema.Schema)
require.True(t, ok, "InputSchema should be *jsonschema.Schema")
assert.Contains(t, schema.Properties, "owner")
Expand Down Expand Up @@ -666,6 +669,9 @@ func Test_GetDiscussionComments(t *testing.T) {

assert.Equal(t, "get_discussion_comments", tool.Name)
assert.NotEmpty(t, tool.Description)
assert.True(t, tool.Annotations.ReadOnlyHint, "get_discussion_comments should be read-only")
require.NotNil(t, tool.Annotations.OpenWorldHint)
assert.True(t, *tool.Annotations.OpenWorldHint, "get_discussion_comments returns untrusted comment UGC")
schema, ok := tool.InputSchema.(*jsonschema.Schema)
require.True(t, ok, "InputSchema should be *jsonschema.Schema")
assert.Contains(t, schema.Properties, "owner")
Expand Down Expand Up @@ -966,6 +972,8 @@ func Test_DiscussionCommentWrite(t *testing.T) {
assert.False(t, tool.Annotations.ReadOnlyHint, "discussion_comment_write should not be read-only")
require.NotNil(t, tool.Annotations.DestructiveHint)
assert.True(t, *tool.Annotations.DestructiveHint, "discussion_comment_write should be destructive")
require.NotNil(t, tool.Annotations.OpenWorldHint)
assert.True(t, *tool.Annotations.OpenWorldHint, "discussion_comment_write publishes discussion comment UGC")
schema, ok := tool.InputSchema.(*jsonschema.Schema)
require.True(t, ok, "InputSchema should be *jsonschema.Schema")
assert.Contains(t, schema.Properties, "method")
Expand Down
15 changes: 9 additions & 6 deletions pkg/github/issues.go
Original file line number Diff line number Diff line change
Expand Up @@ -827,8 +827,9 @@ func IssueRead(t translations.TranslationHelperFunc) inventory.ServerTool {
Name: "issue_read",
Description: t("TOOL_ISSUE_READ_DESCRIPTION", "Get information about a specific issue in a GitHub repository."),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_ISSUE_READ_USER_TITLE", "Get issue details"),
ReadOnlyHint: true,
Title: t("TOOL_ISSUE_READ_USER_TITLE", "Get issue details"),
ReadOnlyHint: true,
OpenWorldHint: jsonschema.Ptr(true),
},
InputSchema: schema,
},
Expand Down Expand Up @@ -1369,8 +1370,9 @@ func AddIssueComment(t translations.TranslationHelperFunc) inventory.ServerTool
Name: "add_issue_comment",
Description: t("TOOL_ADD_ISSUE_COMMENT_DESCRIPTION", "Add a comment and/or reaction to a specific issue or issue comment in a GitHub repository. Use this tool with pull requests as well (in this case pass pull request number as issue_number), but only if user is not asking specifically to add or react to review comments. At least one of body or reaction is required."),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_ADD_ISSUE_COMMENT_USER_TITLE", "Add comment to issue or pull request"),
ReadOnlyHint: false,
Title: t("TOOL_ADD_ISSUE_COMMENT_USER_TITLE", "Add comment to issue or pull request"),
ReadOnlyHint: false,
OpenWorldHint: jsonschema.Ptr(true),
},
InputSchema: &jsonschema.Schema{
Type: "object",
Expand Down Expand Up @@ -2410,8 +2412,9 @@ func IssueWrite(t translations.TranslationHelperFunc) inventory.ServerTool {
Name: "issue_write",
Description: t("TOOL_ISSUE_WRITE_DESCRIPTION", "Create a new or update an existing issue in a GitHub repository."),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_ISSUE_WRITE_USER_TITLE", "Create or update issue/pull request"),
ReadOnlyHint: false,
Title: t("TOOL_ISSUE_WRITE_USER_TITLE", "Create or update issue/pull request"),
ReadOnlyHint: false,
OpenWorldHint: jsonschema.Ptr(true),
},
Meta: mcp.Meta{
"ui": map[string]any{
Expand Down
9 changes: 9 additions & 0 deletions pkg/github/issues_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ func Test_GetIssue(t *testing.T) {

assert.Equal(t, "issue_read", tool.Name)
assert.NotEmpty(t, tool.Description)
assert.True(t, tool.Annotations.ReadOnlyHint, "issue_read should be read-only")
require.NotNil(t, tool.Annotations.OpenWorldHint)
assert.True(t, *tool.Annotations.OpenWorldHint, "issue_read returns untrusted issue/comment UGC")
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "method")
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "owner")
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "repo")
Expand Down Expand Up @@ -1837,6 +1840,9 @@ func Test_CreateIssue(t *testing.T) {

assert.Equal(t, "issue_write", tool.Name)
assert.NotEmpty(t, tool.Description)
assert.False(t, tool.Annotations.ReadOnlyHint, "issue_write should not be read-only")
require.NotNil(t, tool.Annotations.OpenWorldHint)
assert.True(t, *tool.Annotations.OpenWorldHint, "issue_write publishes issue UGC")
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "method")
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "owner")
assert.Contains(t, tool.InputSchema.(*jsonschema.Schema).Properties, "repo")
Expand Down Expand Up @@ -6227,6 +6233,9 @@ func TestAddIssueCommentSchema(t *testing.T) {

assert.Equal(t, "add_issue_comment", tool.Name)
assert.NotEmpty(t, tool.Description)
assert.False(t, tool.Annotations.ReadOnlyHint, "add_issue_comment should not be read-only")
require.NotNil(t, tool.Annotations.OpenWorldHint)
assert.True(t, *tool.Annotations.OpenWorldHint, "add_issue_comment publishes comment UGC")
schema := tool.InputSchema.(*jsonschema.Schema)
assert.Contains(t, schema.Properties, "owner")
assert.Contains(t, schema.Properties, "repo")
Expand Down
20 changes: 12 additions & 8 deletions pkg/github/pullrequests.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,9 @@ Possible options:
Name: "pull_request_read",
Description: t("TOOL_PULL_REQUEST_READ_DESCRIPTION", "Get information on a specific pull request in GitHub repository."),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_GET_PULL_REQUEST_USER_TITLE", "Get details for a single pull request"),
ReadOnlyHint: true,
Title: t("TOOL_GET_PULL_REQUEST_USER_TITLE", "Get details for a single pull request"),
ReadOnlyHint: true,
OpenWorldHint: jsonschema.Ptr(true),
},
InputSchema: schema,
},
Expand Down Expand Up @@ -1214,8 +1215,9 @@ func AddReplyToPullRequestComment(t translations.TranslationHelperFunc) inventor
Name: "add_reply_to_pull_request_comment",
Description: t("TOOL_ADD_REPLY_TO_PULL_REQUEST_COMMENT_DESCRIPTION", "Add a reply and/or reaction to an existing pull request comment. This can create a new comment linked as a reply to the specified comment, add an emoji reaction to the specified comment, or do both. At least one of body or reaction is required."),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_ADD_REPLY_TO_PULL_REQUEST_COMMENT_USER_TITLE", "Add reply to pull request comment"),
ReadOnlyHint: false,
Title: t("TOOL_ADD_REPLY_TO_PULL_REQUEST_COMMENT_USER_TITLE", "Add reply to pull request comment"),
ReadOnlyHint: false,
OpenWorldHint: jsonschema.Ptr(true),
},
InputSchema: schema,
},
Expand Down Expand Up @@ -1864,8 +1866,9 @@ Available methods:
- unresolve_thread: Unresolve a previously resolved review thread. Requires only "threadId" parameter. The owner, repo, and pullNumber parameters are not used for this method. Unresolving an already-unresolved thread is a no-op.
`),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_PULL_REQUEST_REVIEW_WRITE_USER_TITLE", "Write operations (create, submit, delete) on pull request reviews"),
ReadOnlyHint: false,
Title: t("TOOL_PULL_REQUEST_REVIEW_WRITE_USER_TITLE", "Write operations (create, submit, delete) on pull request reviews"),
ReadOnlyHint: false,
OpenWorldHint: jsonschema.Ptr(true),
},
InputSchema: schema,
},
Expand Down Expand Up @@ -2393,8 +2396,9 @@ func AddCommentToPendingReview(t translations.TranslationHelperFunc) inventory.S
Name: "add_comment_to_pending_review",
Description: t("TOOL_ADD_COMMENT_TO_PENDING_REVIEW_DESCRIPTION", "Add review comment to the requester's latest pending pull request review. A pending review needs to already exist to call this (check with the user if not sure)."),
Annotations: &mcp.ToolAnnotations{
Title: t("TOOL_ADD_COMMENT_TO_PENDING_REVIEW_USER_TITLE", "Add review comment to the requester's latest pending pull request review"),
ReadOnlyHint: false,
Title: t("TOOL_ADD_COMMENT_TO_PENDING_REVIEW_USER_TITLE", "Add review comment to the requester's latest pending pull request review"),
ReadOnlyHint: false,
OpenWorldHint: jsonschema.Ptr(true),
},
InputSchema: schema,
},
Expand Down
12 changes: 12 additions & 0 deletions pkg/github/pullrequests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ func Test_GetPullRequest(t *testing.T) {

assert.Equal(t, "pull_request_read", tool.Name)
assert.NotEmpty(t, tool.Description)
assert.True(t, tool.Annotations.ReadOnlyHint, "pull_request_read should be read-only")
require.NotNil(t, tool.Annotations.OpenWorldHint)
assert.True(t, *tool.Annotations.OpenWorldHint, "pull_request_read returns untrusted PR/review UGC")
schema := tool.InputSchema.(*jsonschema.Schema)
assert.Contains(t, schema.Properties, "method")
assert.Contains(t, schema.Properties, "owner")
Expand Down Expand Up @@ -3195,6 +3198,9 @@ func TestCreateAndSubmitPullRequestReview(t *testing.T) {

assert.Equal(t, "pull_request_review_write", tool.Name)
assert.NotEmpty(t, tool.Description)
assert.False(t, tool.Annotations.ReadOnlyHint, "pull_request_review_write should not be read-only")
require.NotNil(t, tool.Annotations.OpenWorldHint)
assert.True(t, *tool.Annotations.OpenWorldHint, "pull_request_review_write publishes review UGC")
schema := tool.InputSchema.(*jsonschema.Schema)
assert.Contains(t, schema.Properties, "method")
assert.Contains(t, schema.Properties, "owner")
Expand Down Expand Up @@ -3646,6 +3652,9 @@ func TestAddPullRequestReviewCommentToPendingReview(t *testing.T) {

assert.Equal(t, "add_comment_to_pending_review", tool.Name)
assert.NotEmpty(t, tool.Description)
assert.False(t, tool.Annotations.ReadOnlyHint, "add_comment_to_pending_review should not be read-only")
require.NotNil(t, tool.Annotations.OpenWorldHint)
assert.True(t, *tool.Annotations.OpenWorldHint, "add_comment_to_pending_review publishes review comment UGC")
schema := tool.InputSchema.(*jsonschema.Schema)
assert.Contains(t, schema.Properties, "owner")
assert.Contains(t, schema.Properties, "repo")
Expand Down Expand Up @@ -4334,6 +4343,9 @@ func TestAddReplyToPullRequestComment(t *testing.T) {

assert.Equal(t, "add_reply_to_pull_request_comment", tool.Name)
assert.NotEmpty(t, tool.Description)
assert.False(t, tool.Annotations.ReadOnlyHint, "add_reply_to_pull_request_comment should not be read-only")
require.NotNil(t, tool.Annotations.OpenWorldHint)
assert.True(t, *tool.Annotations.OpenWorldHint, "add_reply_to_pull_request_comment publishes reply UGC")
schema := tool.InputSchema.(*jsonschema.Schema)
assert.Contains(t, schema.Properties, "owner")
assert.Contains(t, schema.Properties, "repo")
Expand Down