@@ -14,14 +14,38 @@ import (
1414type GetClientFn func (context.Context ) (* github.Client , error )
1515type GetGQLClientFn func (context.Context ) (* githubv4.Client , error )
1616
17- var DefaultTools = []string {"context" , "repos" , "issues" , "pull_requests" }
17+ type Toolset string
18+
19+ const (
20+ ToolsetContext Toolset = "context"
21+ ToolsetRepos Toolset = "repos"
22+ ToolsetIssues Toolset = "issues"
23+ ToolsetUsers Toolset = "users"
24+ ToolsetOrgs Toolset = "orgs"
25+ ToolsetPullRequests Toolset = "pull_requests"
26+ ToolsetCodeSecurity Toolset = "code_security"
27+ ToolsetSecretProtection Toolset = "secret_protection"
28+ ToolsetDependabot Toolset = "dependabot"
29+ ToolsetNotifications Toolset = "notifications"
30+ ToolsetDiscussions Toolset = "discussions"
31+ ToolsetActions Toolset = "actions"
32+ ToolsetSecurityAdvisories Toolset = "security_advisories"
33+ ToolsetExperiments Toolset = "experiments"
34+ ToolsetGists Toolset = "gists"
35+ ToolsetProjects Toolset = "projects"
36+ ToolsetStargazers Toolset = "stargazers"
37+ ToolsetDynamic Toolset = "dynamic"
38+ )
39+
40+ // DefaultTools contains the default toolsets to enable
41+ var DefaultTools = []Toolset {ToolsetContext , ToolsetRepos , ToolsetIssues , ToolsetPullRequests }
1842
1943func DefaultToolsetGroup (readOnly bool , getClient GetClientFn , getGQLClient GetGQLClientFn , getRawClient raw.GetRawClientFn , t translations.TranslationHelperFunc , contentWindowSize int ) * toolsets.ToolsetGroup {
2044 tsg := toolsets .NewToolsetGroup (readOnly )
2145
2246 // Define all available features with their default state (disabled)
2347 // Create toolsets
24- repos := toolsets .NewToolset ("repos" , "GitHub Repository related tools" ).
48+ repos := toolsets .NewToolset (string ( ToolsetRepos ) , "GitHub Repository related tools" ).
2549 AddReadTools (
2650 toolsets .NewServerTool (SearchRepositories (getClient , t )),
2751 toolsets .NewServerTool (GetFileContents (getClient , getRawClient , t )),
@@ -50,7 +74,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
5074 toolsets .NewServerResourceTemplate (GetRepositoryResourceTagContent (getClient , getRawClient , t )),
5175 toolsets .NewServerResourceTemplate (GetRepositoryResourcePrContent (getClient , getRawClient , t )),
5276 )
53- issues := toolsets .NewToolset ("issues" , "GitHub Issues related tools" ).
77+ issues := toolsets .NewToolset (string ( ToolsetIssues ) , "GitHub Issues related tools" ).
5478 AddReadTools (
5579 toolsets .NewServerTool (GetIssue (getClient , t )),
5680 toolsets .NewServerTool (SearchIssues (getClient , t )),
@@ -71,15 +95,15 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
7195 toolsets .NewServerPrompt (AssignCodingAgentPrompt (t )),
7296 toolsets .NewServerPrompt (IssueToFixWorkflowPrompt (t )),
7397 )
74- users := toolsets .NewToolset ("users" , "GitHub User related tools" ).
98+ users := toolsets .NewToolset (string ( ToolsetUsers ) , "GitHub User related tools" ).
7599 AddReadTools (
76100 toolsets .NewServerTool (SearchUsers (getClient , t )),
77101 )
78- orgs := toolsets .NewToolset ("orgs" , "GitHub Organization related tools" ).
102+ orgs := toolsets .NewToolset (string ( ToolsetOrgs ) , "GitHub Organization related tools" ).
79103 AddReadTools (
80104 toolsets .NewServerTool (SearchOrgs (getClient , t )),
81105 )
82- pullRequests := toolsets .NewToolset ("pull_requests" , "GitHub Pull Request related tools" ).
106+ pullRequests := toolsets .NewToolset (string ( ToolsetPullRequests ) , "GitHub Pull Request related tools" ).
83107 AddReadTools (
84108 toolsets .NewServerTool (GetPullRequest (getClient , t )),
85109 toolsets .NewServerTool (ListPullRequests (getClient , t )),
@@ -104,23 +128,23 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
104128 toolsets .NewServerTool (SubmitPendingPullRequestReview (getGQLClient , t )),
105129 toolsets .NewServerTool (DeletePendingPullRequestReview (getGQLClient , t )),
106130 )
107- codeSecurity := toolsets .NewToolset ("code_security" , "Code security related tools, such as GitHub Code Scanning" ).
131+ codeSecurity := toolsets .NewToolset (string ( ToolsetCodeSecurity ) , "Code security related tools, such as GitHub Code Scanning" ).
108132 AddReadTools (
109133 toolsets .NewServerTool (GetCodeScanningAlert (getClient , t )),
110134 toolsets .NewServerTool (ListCodeScanningAlerts (getClient , t )),
111135 )
112- secretProtection := toolsets .NewToolset ("secret_protection" , "Secret protection related tools, such as GitHub Secret Scanning" ).
136+ secretProtection := toolsets .NewToolset (string ( ToolsetSecretProtection ) , "Secret protection related tools, such as GitHub Secret Scanning" ).
113137 AddReadTools (
114138 toolsets .NewServerTool (GetSecretScanningAlert (getClient , t )),
115139 toolsets .NewServerTool (ListSecretScanningAlerts (getClient , t )),
116140 )
117- dependabot := toolsets .NewToolset ("dependabot" , "Dependabot tools" ).
141+ dependabot := toolsets .NewToolset (string ( ToolsetDependabot ) , "Dependabot tools" ).
118142 AddReadTools (
119143 toolsets .NewServerTool (GetDependabotAlert (getClient , t )),
120144 toolsets .NewServerTool (ListDependabotAlerts (getClient , t )),
121145 )
122146
123- notifications := toolsets .NewToolset ("notifications" , "GitHub Notifications related tools" ).
147+ notifications := toolsets .NewToolset (string ( ToolsetNotifications ) , "GitHub Notifications related tools" ).
124148 AddReadTools (
125149 toolsets .NewServerTool (ListNotifications (getClient , t )),
126150 toolsets .NewServerTool (GetNotificationDetails (getClient , t )),
@@ -132,15 +156,15 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
132156 toolsets .NewServerTool (ManageRepositoryNotificationSubscription (getClient , t )),
133157 )
134158
135- discussions := toolsets .NewToolset ("discussions" , "GitHub Discussions related tools" ).
159+ discussions := toolsets .NewToolset (string ( ToolsetDiscussions ) , "GitHub Discussions related tools" ).
136160 AddReadTools (
137161 toolsets .NewServerTool (ListDiscussions (getGQLClient , t )),
138162 toolsets .NewServerTool (GetDiscussion (getGQLClient , t )),
139163 toolsets .NewServerTool (GetDiscussionComments (getGQLClient , t )),
140164 toolsets .NewServerTool (ListDiscussionCategories (getGQLClient , t )),
141165 )
142166
143- actions := toolsets .NewToolset ("actions" , "GitHub Actions workflows and CI/CD operations" ).
167+ actions := toolsets .NewToolset (string ( ToolsetActions ) , "GitHub Actions workflows and CI/CD operations" ).
144168 AddReadTools (
145169 toolsets .NewServerTool (ListWorkflows (getClient , t )),
146170 toolsets .NewServerTool (ListWorkflowRuns (getClient , t )),
@@ -160,7 +184,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
160184 toolsets .NewServerTool (DeleteWorkflowRunLogs (getClient , t )),
161185 )
162186
163- securityAdvisories := toolsets .NewToolset ("security_advisories" , "Security advisories related tools" ).
187+ securityAdvisories := toolsets .NewToolset (string ( ToolsetSecurityAdvisories ) , "Security advisories related tools" ).
164188 AddReadTools (
165189 toolsets .NewServerTool (ListGlobalSecurityAdvisories (getClient , t )),
166190 toolsets .NewServerTool (GetGlobalSecurityAdvisory (getClient , t )),
@@ -169,16 +193,16 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
169193 )
170194
171195 // Keep experiments alive so the system doesn't error out when it's always enabled
172- experiments := toolsets .NewToolset ("experiments" , "Experimental features that are not considered stable yet" )
196+ experiments := toolsets .NewToolset (string ( ToolsetExperiments ) , "Experimental features that are not considered stable yet" )
173197
174- contextTools := toolsets .NewToolset ("context" , "Tools that provide context about the current user and GitHub context you are operating in" ).
198+ contextTools := toolsets .NewToolset (string ( ToolsetContext ) , "Tools that provide context about the current user and GitHub context you are operating in" ).
175199 AddReadTools (
176200 toolsets .NewServerTool (GetMe (getClient , t )),
177201 toolsets .NewServerTool (GetTeams (getClient , getGQLClient , t )),
178202 toolsets .NewServerTool (GetTeamMembers (getGQLClient , t )),
179203 )
180204
181- gists := toolsets .NewToolset ("gists" , "GitHub Gist related tools" ).
205+ gists := toolsets .NewToolset (string ( ToolsetGists ) , "GitHub Gist related tools" ).
182206 AddReadTools (
183207 toolsets .NewServerTool (ListGists (getClient , t )),
184208 ).
@@ -187,12 +211,12 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
187211 toolsets .NewServerTool (UpdateGist (getClient , t )),
188212 )
189213
190- projects := toolsets .NewToolset ("projects" , "GitHub Projects related tools" ).
214+ projects := toolsets .NewToolset (string ( ToolsetProjects ) , "GitHub Projects related tools" ).
191215 AddReadTools (
192216 toolsets .NewServerTool (ListProjects (getClient , t )),
193217 )
194218
195- stargazers := toolsets .NewToolset ("stargazers" , "GitHub Starring related tools" ).
219+ stargazers := toolsets .NewToolset (string ( ToolsetStargazers ) , "GitHub Starring related tools" ).
196220 AddReadTools (toolsets .NewServerTool (ListStarredRepositories (getClient , t ))).AddWriteTools (
197221 toolsets .NewServerTool (StarRepository (getClient , t )),
198222 toolsets .NewServerTool (UnstarRepository (getClient , t )),
@@ -224,7 +248,7 @@ func DefaultToolsetGroup(readOnly bool, getClient GetClientFn, getGQLClient GetG
224248func InitDynamicToolset (s * server.MCPServer , tsg * toolsets.ToolsetGroup , t translations.TranslationHelperFunc ) * toolsets.Toolset {
225249 // Create a new dynamic toolset
226250 // Need to add the dynamic toolset last so it can be used to enable other toolsets
227- 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." ).
251+ dynamicToolSelection := toolsets .NewToolset (string ( ToolsetDynamic ) , "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." ).
228252 AddReadTools (
229253 toolsets .NewServerTool (ListAvailableToolsets (tsg , t )),
230254 toolsets .NewServerTool (GetToolsetsTools (tsg , t )),
0 commit comments