Skip to content

Commit ea3025e

Browse files
committed
fix annotation
1 parent 4f508c0 commit ea3025e

File tree

3 files changed

+145
-146
lines changed

3 files changed

+145
-146
lines changed

pkg/github/__toolsnaps__/get_pull_request_diff.snap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"annotations": {
3+
"readOnlyHint": true,
34
"title": "Get pull request diff"
45
},
56
"description": "Get the diff of a pull request.",

pkg/github/pullrequests.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ func GetPullRequestDiff(getClient GetClientFn, t translations.TranslationHelperF
16991699
Description: t("TOOL_GET_PULL_REQUEST_DIFF_DESCRIPTION", "Get the diff of a pull request."),
17001700
Annotations: &mcp.ToolAnnotations{
17011701
Title: t("TOOL_GET_PULL_REQUEST_DIFF_USER_TITLE", "Get pull request diff"),
1702-
ReadOnlyHint: false,
1702+
ReadOnlyHint: true,
17031703
},
17041704
InputSchema: &jsonschema.Schema{
17051705
Required: []string{"owner", "repo", "pullNumber"},

pkg/github/tools.go

Lines changed: 143 additions & 145 deletions
Original file line numberDiff line numberDiff line change
@@ -21,136 +21,136 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
2121

2222
// Define all available features with their default state (disabled)
2323
// Create toolsets
24-
// repos := toolsets.NewToolset("repos", "GitHub Repository related tools").
25-
// AddReadTools(
26-
// toolsets.NewServerTool(SearchRepositories(getClient, t)),
27-
// toolsets.NewServerTool(GetFileContents(getClient, getRawClient, t)),
28-
// toolsets.NewServerTool(ListCommits(getClient, t)),
29-
// toolsets.NewServerTool(SearchCode(getClient, t)),
30-
// toolsets.NewServerTool(GetCommit(getClient, t)),
31-
// toolsets.NewServerTool(ListBranches(getClient, t)),
32-
// toolsets.NewServerTool(ListTags(getClient, t)),
33-
// toolsets.NewServerTool(GetTag(getClient, t)),
34-
// ).
35-
// AddWriteTools(
36-
// toolsets.NewServerTool(CreateOrUpdateFile(getClient, t)),
37-
// toolsets.NewServerTool(CreateRepository(getClient, t)),
38-
// toolsets.NewServerTool(ForkRepository(getClient, t)),
39-
// toolsets.NewServerTool(CreateBranch(getClient, t)),
40-
// toolsets.NewServerTool(PushFiles(getClient, t)),
41-
// toolsets.NewServerTool(DeleteFile(getClient, t)),
42-
// ).
43-
// AddResourceTemplates(
44-
// toolsets.NewServerResourceTemplate(GetRepositoryResourceContent(getClient, getRawClient, t)),
45-
// toolsets.NewServerResourceTemplate(GetRepositoryResourceBranchContent(getClient, getRawClient, t)),
46-
// toolsets.NewServerResourceTemplate(GetRepositoryResourceCommitContent(getClient, getRawClient, t)),
47-
// toolsets.NewServerResourceTemplate(GetRepositoryResourceTagContent(getClient, getRawClient, t)),
48-
// toolsets.NewServerResourceTemplate(GetRepositoryResourcePrContent(getClient, getRawClient, t)),
49-
// )
50-
// issues := toolsets.NewToolset("issues", "GitHub Issues related tools").
51-
// AddReadTools(
52-
// toolsets.NewServerTool(GetIssue(getClient, t)),
53-
// toolsets.NewServerTool(SearchIssues(getClient, t)),
54-
// toolsets.NewServerTool(ListIssues(getClient, t)),
55-
// toolsets.NewServerTool(GetIssueComments(getClient, t)),
56-
// ).
57-
// AddWriteTools(
58-
// toolsets.NewServerTool(CreateIssue(getClient, t)),
59-
// toolsets.NewServerTool(AddIssueComment(getClient, t)),
60-
// toolsets.NewServerTool(UpdateIssue(getClient, t)),
61-
// toolsets.NewServerTool(AssignCopilotToIssue(getGQLClient, t)),
62-
// ).AddPrompts(toolsets.NewServerPrompt(AssignCodingAgentPrompt(t)))
63-
// users := toolsets.NewToolset("users", "GitHub User related tools").
64-
// AddReadTools(
65-
// toolsets.NewServerTool(SearchUsers(getClient, t)),
66-
// )
67-
// orgs := toolsets.NewToolset("orgs", "GitHub Organization related tools").
68-
// AddReadTools(
69-
// toolsets.NewServerTool(SearchOrgs(getClient, t)),
70-
// )
71-
// pullRequests := toolsets.NewToolset("pull_requests", "GitHub Pull Request related tools").
72-
// AddReadTools(
73-
// toolsets.NewServerTool(GetPullRequest(getClient, t)),
74-
// toolsets.NewServerTool(ListPullRequests(getClient, t)),
75-
// toolsets.NewServerTool(GetPullRequestFiles(getClient, t)),
76-
// toolsets.NewServerTool(SearchPullRequests(getClient, t)),
77-
// toolsets.NewServerTool(GetPullRequestStatus(getClient, t)),
78-
// toolsets.NewServerTool(GetPullRequestComments(getClient, t)),
79-
// toolsets.NewServerTool(GetPullRequestReviews(getClient, t)),
80-
// toolsets.NewServerTool(GetPullRequestDiff(getClient, t)),
81-
// ).
82-
// AddWriteTools(
83-
// toolsets.NewServerTool(MergePullRequest(getClient, t)),
84-
// toolsets.NewServerTool(UpdatePullRequestBranch(getClient, t)),
85-
// toolsets.NewServerTool(CreatePullRequest(getClient, t)),
86-
// toolsets.NewServerTool(UpdatePullRequest(getClient, t)),
87-
// toolsets.NewServerTool(RequestCopilotReview(getClient, t)),
88-
89-
// // Reviews
90-
// toolsets.NewServerTool(CreateAndSubmitPullRequestReview(getGQLClient, t)),
91-
// toolsets.NewServerTool(CreatePendingPullRequestReview(getGQLClient, t)),
92-
// toolsets.NewServerTool(AddPullRequestReviewCommentToPendingReview(getGQLClient, t)),
93-
// toolsets.NewServerTool(SubmitPendingPullRequestReview(getGQLClient, t)),
94-
// toolsets.NewServerTool(DeletePendingPullRequestReview(getGQLClient, t)),
95-
// )
96-
// codeSecurity := toolsets.NewToolset("code_security", "Code security related tools, such as GitHub Code Scanning").
97-
// AddReadTools(
98-
// toolsets.NewServerTool(GetCodeScanningAlert(getClient, t)),
99-
// toolsets.NewServerTool(ListCodeScanningAlerts(getClient, t)),
100-
// )
101-
// secretProtection := toolsets.NewToolset("secret_protection", "Secret protection related tools, such as GitHub Secret Scanning").
102-
// AddReadTools(
103-
// toolsets.NewServerTool(GetSecretScanningAlert(getClient, t)),
104-
// toolsets.NewServerTool(ListSecretScanningAlerts(getClient, t)),
105-
// )
106-
// dependabot := toolsets.NewToolset("dependabot", "Dependabot tools").
107-
// AddReadTools(
108-
// toolsets.NewServerTool(GetDependabotAlert(getClient, t)),
109-
// toolsets.NewServerTool(ListDependabotAlerts(getClient, t)),
110-
// )
111-
112-
// notifications := toolsets.NewToolset("notifications", "GitHub Notifications related tools").
113-
// AddReadTools(
114-
// toolsets.NewServerTool(ListNotifications(getClient, t)),
115-
// toolsets.NewServerTool(GetNotificationDetails(getClient, t)),
116-
// ).
117-
// AddWriteTools(
118-
// toolsets.NewServerTool(DismissNotification(getClient, t)),
119-
// toolsets.NewServerTool(MarkAllNotificationsRead(getClient, t)),
120-
// toolsets.NewServerTool(ManageNotificationSubscription(getClient, t)),
121-
// toolsets.NewServerTool(ManageRepositoryNotificationSubscription(getClient, t)),
122-
// )
123-
124-
// discussions := toolsets.NewToolset("discussions", "GitHub Discussions related tools").
125-
// AddReadTools(
126-
// toolsets.NewServerTool(ListDiscussions(getGQLClient, t)),
127-
// toolsets.NewServerTool(GetDiscussion(getGQLClient, t)),
128-
// toolsets.NewServerTool(GetDiscussionComments(getGQLClient, t)),
129-
// toolsets.NewServerTool(ListDiscussionCategories(getGQLClient, t)),
130-
// )
131-
132-
// actions := toolsets.NewToolset("actions", "GitHub Actions workflows and CI/CD operations").
133-
// AddReadTools(
134-
// toolsets.NewServerTool(ListWorkflows(getClient, t)),
135-
// toolsets.NewServerTool(ListWorkflowRuns(getClient, t)),
136-
// toolsets.NewServerTool(GetWorkflowRun(getClient, t)),
137-
// toolsets.NewServerTool(GetWorkflowRunLogs(getClient, t)),
138-
// toolsets.NewServerTool(ListWorkflowJobs(getClient, t)),
139-
// toolsets.NewServerTool(GetJobLogs(getClient, t)),
140-
// toolsets.NewServerTool(ListWorkflowRunArtifacts(getClient, t)),
141-
// toolsets.NewServerTool(DownloadWorkflowRunArtifact(getClient, t)),
142-
// toolsets.NewServerTool(GetWorkflowRunUsage(getClient, t)),
143-
// ).
144-
// AddWriteTools(
145-
// toolsets.NewServerTool(RunWorkflow(getClient, t)),
146-
// toolsets.NewServerTool(RerunWorkflowRun(getClient, t)),
147-
// toolsets.NewServerTool(RerunFailedJobs(getClient, t)),
148-
// toolsets.NewServerTool(CancelWorkflowRun(getClient, t)),
149-
// toolsets.NewServerTool(DeleteWorkflowRunLogs(getClient, t)),
150-
// )
24+
repos := toolsets.NewToolset("repos", "GitHub Repository related tools").
25+
AddReadTools(
26+
toolsets.NewServerTool(SearchRepositories(getClient, t)),
27+
toolsets.NewServerTool(GetFileContents(getClient, getRawClient, t)),
28+
toolsets.NewServerTool(ListCommits(getClient, t)),
29+
toolsets.NewServerTool(SearchCode(getClient, t)),
30+
toolsets.NewServerTool(GetCommit(getClient, t)),
31+
toolsets.NewServerTool(ListBranches(getClient, t)),
32+
toolsets.NewServerTool(ListTags(getClient, t)),
33+
toolsets.NewServerTool(GetTag(getClient, t)),
34+
).
35+
AddWriteTools(
36+
toolsets.NewServerTool(CreateOrUpdateFile(getClient, t)),
37+
toolsets.NewServerTool(CreateRepository(getClient, t)),
38+
toolsets.NewServerTool(ForkRepository(getClient, t)),
39+
toolsets.NewServerTool(CreateBranch(getClient, t)),
40+
toolsets.NewServerTool(PushFiles(getClient, t)),
41+
toolsets.NewServerTool(DeleteFile(getClient, t)),
42+
)
43+
// AddResourceTemplates(
44+
// toolsets.NewServerResourceTemplate(GetRepositoryResourceContent(getClient, getRawClient, t)),
45+
// toolsets.NewServerResourceTemplate(GetRepositoryResourceBranchContent(getClient, getRawClient, t)),
46+
// toolsets.NewServerResourceTemplate(GetRepositoryResourceCommitContent(getClient, getRawClient, t)),
47+
// toolsets.NewServerResourceTemplate(GetRepositoryResourceTagContent(getClient, getRawClient, t)),
48+
// toolsets.NewServerResourceTemplate(GetRepositoryResourcePrContent(getClient, getRawClient, t)),
49+
// )
50+
issues := toolsets.NewToolset("issues", "GitHub Issues related tools").
51+
AddReadTools(
52+
toolsets.NewServerTool(GetIssue(getClient, t)),
53+
toolsets.NewServerTool(SearchIssues(getClient, t)),
54+
toolsets.NewServerTool(ListIssues(getClient, t)),
55+
toolsets.NewServerTool(GetIssueComments(getClient, t)),
56+
).
57+
AddWriteTools(
58+
toolsets.NewServerTool(CreateIssue(getClient, t)),
59+
toolsets.NewServerTool(AddIssueComment(getClient, t)),
60+
toolsets.NewServerTool(UpdateIssue(getClient, t)),
61+
toolsets.NewServerTool(AssignCopilotToIssue(getGQLClient, t)),
62+
).AddPrompts(toolsets.NewServerPrompt(AssignCodingAgentPrompt(t)))
63+
users := toolsets.NewToolset("users", "GitHub User related tools").
64+
AddReadTools(
65+
toolsets.NewServerTool(SearchUsers(getClient, t)),
66+
)
67+
orgs := toolsets.NewToolset("orgs", "GitHub Organization related tools").
68+
AddReadTools(
69+
toolsets.NewServerTool(SearchOrgs(getClient, t)),
70+
)
71+
pullRequests := toolsets.NewToolset("pull_requests", "GitHub Pull Request related tools").
72+
AddReadTools(
73+
toolsets.NewServerTool(GetPullRequest(getClient, t)),
74+
toolsets.NewServerTool(ListPullRequests(getClient, t)),
75+
toolsets.NewServerTool(GetPullRequestFiles(getClient, t)),
76+
toolsets.NewServerTool(SearchPullRequests(getClient, t)),
77+
toolsets.NewServerTool(GetPullRequestStatus(getClient, t)),
78+
toolsets.NewServerTool(GetPullRequestComments(getClient, t)),
79+
toolsets.NewServerTool(GetPullRequestReviews(getClient, t)),
80+
toolsets.NewServerTool(GetPullRequestDiff(getClient, t)),
81+
).
82+
AddWriteTools(
83+
toolsets.NewServerTool(MergePullRequest(getClient, t)),
84+
toolsets.NewServerTool(UpdatePullRequestBranch(getClient, t)),
85+
toolsets.NewServerTool(CreatePullRequest(getClient, t)),
86+
toolsets.NewServerTool(UpdatePullRequest(getClient, t)),
87+
toolsets.NewServerTool(RequestCopilotReview(getClient, t)),
88+
89+
// Reviews
90+
toolsets.NewServerTool(CreateAndSubmitPullRequestReview(getGQLClient, t)),
91+
toolsets.NewServerTool(CreatePendingPullRequestReview(getGQLClient, t)),
92+
toolsets.NewServerTool(AddPullRequestReviewCommentToPendingReview(getGQLClient, t)),
93+
toolsets.NewServerTool(SubmitPendingPullRequestReview(getGQLClient, t)),
94+
toolsets.NewServerTool(DeletePendingPullRequestReview(getGQLClient, t)),
95+
)
96+
codeSecurity := toolsets.NewToolset("code_security", "Code security related tools, such as GitHub Code Scanning").
97+
AddReadTools(
98+
toolsets.NewServerTool(GetCodeScanningAlert(getClient, t)),
99+
toolsets.NewServerTool(ListCodeScanningAlerts(getClient, t)),
100+
)
101+
secretProtection := toolsets.NewToolset("secret_protection", "Secret protection related tools, such as GitHub Secret Scanning").
102+
AddReadTools(
103+
toolsets.NewServerTool(GetSecretScanningAlert(getClient, t)),
104+
toolsets.NewServerTool(ListSecretScanningAlerts(getClient, t)),
105+
)
106+
dependabot := toolsets.NewToolset("dependabot", "Dependabot tools").
107+
AddReadTools(
108+
toolsets.NewServerTool(GetDependabotAlert(getClient, t)),
109+
toolsets.NewServerTool(ListDependabotAlerts(getClient, t)),
110+
)
111+
112+
notifications := toolsets.NewToolset("notifications", "GitHub Notifications related tools").
113+
AddReadTools(
114+
toolsets.NewServerTool(ListNotifications(getClient, t)),
115+
toolsets.NewServerTool(GetNotificationDetails(getClient, t)),
116+
).
117+
AddWriteTools(
118+
toolsets.NewServerTool(DismissNotification(getClient, t)),
119+
toolsets.NewServerTool(MarkAllNotificationsRead(getClient, t)),
120+
toolsets.NewServerTool(ManageNotificationSubscription(getClient, t)),
121+
toolsets.NewServerTool(ManageRepositoryNotificationSubscription(getClient, t)),
122+
)
123+
124+
discussions := toolsets.NewToolset("discussions", "GitHub Discussions related tools").
125+
AddReadTools(
126+
toolsets.NewServerTool(ListDiscussions(getGQLClient, t)),
127+
toolsets.NewServerTool(GetDiscussion(getGQLClient, t)),
128+
toolsets.NewServerTool(GetDiscussionComments(getGQLClient, t)),
129+
toolsets.NewServerTool(ListDiscussionCategories(getGQLClient, t)),
130+
)
131+
132+
actions := toolsets.NewToolset("actions", "GitHub Actions workflows and CI/CD operations").
133+
AddReadTools(
134+
toolsets.NewServerTool(ListWorkflows(getClient, t)),
135+
toolsets.NewServerTool(ListWorkflowRuns(getClient, t)),
136+
toolsets.NewServerTool(GetWorkflowRun(getClient, t)),
137+
toolsets.NewServerTool(GetWorkflowRunLogs(getClient, t)),
138+
toolsets.NewServerTool(ListWorkflowJobs(getClient, t)),
139+
toolsets.NewServerTool(GetJobLogs(getClient, t)),
140+
toolsets.NewServerTool(ListWorkflowRunArtifacts(getClient, t)),
141+
toolsets.NewServerTool(DownloadWorkflowRunArtifact(getClient, t)),
142+
toolsets.NewServerTool(GetWorkflowRunUsage(getClient, t)),
143+
).
144+
AddWriteTools(
145+
toolsets.NewServerTool(RunWorkflow(getClient, t)),
146+
toolsets.NewServerTool(RerunWorkflowRun(getClient, t)),
147+
toolsets.NewServerTool(RerunFailedJobs(getClient, t)),
148+
toolsets.NewServerTool(CancelWorkflowRun(getClient, t)),
149+
toolsets.NewServerTool(DeleteWorkflowRunLogs(getClient, t)),
150+
)
151151

152152
// // Keep experiments alive so the system doesn't error out when it's always enabled
153-
// experiments := toolsets.NewToolset("experiments", "Experimental features that are not considered stable yet")
153+
experiments := toolsets.NewToolset("experiments", "Experimental features that are not considered stable yet")
154154

155155
contextTools := toolsets.NewToolset("context", "Tools that provide context about the current user and GitHub context you are operating in").
156156
AddReadTools(
@@ -159,18 +159,18 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
159159

160160
// // Add toolsets to the group
161161
tsg.AddToolset(contextTools)
162-
// tsg.AddToolset(repos)
163-
// tsg.AddToolset(issues)
164-
// tsg.AddToolset(orgs)
165-
// tsg.AddToolset(users)
166-
// tsg.AddToolset(pullRequests)
167-
// tsg.AddToolset(actions)
168-
// tsg.AddToolset(codeSecurity)
169-
// tsg.AddToolset(secretProtection)
170-
// tsg.AddToolset(dependabot)
171-
// tsg.AddToolset(notifications)
172-
// tsg.AddToolset(experiments)
173-
// tsg.AddToolset(discussions)
162+
tsg.AddToolset(repos)
163+
tsg.AddToolset(issues)
164+
tsg.AddToolset(orgs)
165+
tsg.AddToolset(users)
166+
tsg.AddToolset(pullRequests)
167+
tsg.AddToolset(actions)
168+
tsg.AddToolset(codeSecurity)
169+
tsg.AddToolset(secretProtection)
170+
tsg.AddToolset(dependabot)
171+
tsg.AddToolset(notifications)
172+
tsg.AddToolset(experiments)
173+
tsg.AddToolset(discussions)
174174

175175
return tsg
176176
}
@@ -181,9 +181,9 @@ func InitDynamicToolset(s *mcp.Server, tsg *toolsets.ToolsetGroup, t translation
181181
// Need to add the dynamic toolset last so it can be used to enable other toolsets
182182
dynamicToolSelection := toolsets.NewToolset("dynamic", "Discover GitHub MCP tools that can help achieve tasks by enabling additional sets of tools, you can control the enablement of any toolset to access its tools when this toolset is enabled.").
183183
AddReadTools(
184-
// toolsets.NewServerTool(ListAvailableToolsets(tsg, t)),
185-
// toolsets.NewServerTool(GetToolsetsTools(tsg, t)),
186-
// toolsets.NewServerTool(EnableToolset(s, tsg, t)),
184+
toolsets.NewServerTool(ListAvailableToolsets(tsg, t)),
185+
toolsets.NewServerTool(GetToolsetsTools(tsg, t)),
186+
toolsets.NewServerTool(EnableToolset(s, tsg, t)),
187187
)
188188

189189
dynamicToolSelection.Enabled = true
@@ -203,5 +203,3 @@ func ToStringPtr(s string) *string {
203203
}
204204
return &s
205205
}
206-
207-

0 commit comments

Comments
 (0)