@@ -16,102 +16,172 @@ type GetGQLClientFn func(context.Context) (*githubv4.Client, error)
1616
1717// Toolset metadata constants - these define all available toolsets and their descriptions.
1818// Tools use these constants to declare which toolset they belong to.
19+ // Icons are Octicon names from https://primer.style/foundations/icons
1920var (
2021 ToolsetMetadataAll = registry.ToolsetMetadata {
2122 ID : "all" ,
2223 Description : "Special toolset that enables all available toolsets" ,
24+ Icon : "apps" ,
2325 }
2426 ToolsetMetadataDefault = registry.ToolsetMetadata {
2527 ID : "default" ,
2628 Description : "Special toolset that enables the default toolset configuration. When no toolsets are specified, this is the set that is enabled" ,
29+ Icon : "check-circle" ,
2730 }
2831 ToolsetMetadataContext = registry.ToolsetMetadata {
2932 ID : "context" ,
3033 Description : "Tools that provide context about the current user and GitHub context you are operating in" ,
3134 Default : true ,
35+ Icon : "person" ,
3236 }
3337 ToolsetMetadataRepos = registry.ToolsetMetadata {
3438 ID : "repos" ,
3539 Description : "GitHub Repository related tools" ,
3640 Default : true ,
41+ Icon : "repo" ,
3742 }
3843 ToolsetMetadataGit = registry.ToolsetMetadata {
3944 ID : "git" ,
4045 Description : "GitHub Git API related tools for low-level Git operations" ,
46+ Icon : "git-branch" ,
4147 }
4248 ToolsetMetadataIssues = registry.ToolsetMetadata {
4349 ID : "issues" ,
4450 Description : "GitHub Issues related tools" ,
4551 Default : true ,
52+ Icon : "issue-opened" ,
4653 }
4754 ToolsetMetadataPullRequests = registry.ToolsetMetadata {
4855 ID : "pull_requests" ,
4956 Description : "GitHub Pull Request related tools" ,
5057 Default : true ,
58+ Icon : "git-pull-request" ,
5159 }
5260 ToolsetMetadataUsers = registry.ToolsetMetadata {
5361 ID : "users" ,
5462 Description : "GitHub User related tools" ,
5563 Default : true ,
64+ Icon : "people" ,
5665 }
5766 ToolsetMetadataOrgs = registry.ToolsetMetadata {
5867 ID : "orgs" ,
5968 Description : "GitHub Organization related tools" ,
69+ Icon : "organization" ,
6070 }
6171 ToolsetMetadataActions = registry.ToolsetMetadata {
6272 ID : "actions" ,
6373 Description : "GitHub Actions workflows and CI/CD operations" ,
74+ Icon : "workflow" ,
6475 }
6576 ToolsetMetadataCodeSecurity = registry.ToolsetMetadata {
6677 ID : "code_security" ,
6778 Description : "Code security related tools, such as GitHub Code Scanning" ,
79+ Icon : "codescan" ,
6880 }
6981 ToolsetMetadataSecretProtection = registry.ToolsetMetadata {
7082 ID : "secret_protection" ,
7183 Description : "Secret protection related tools, such as GitHub Secret Scanning" ,
84+ Icon : "shield-lock" ,
7285 }
7386 ToolsetMetadataDependabot = registry.ToolsetMetadata {
7487 ID : "dependabot" ,
7588 Description : "Dependabot tools" ,
89+ Icon : "dependabot" ,
7690 }
7791 ToolsetMetadataNotifications = registry.ToolsetMetadata {
7892 ID : "notifications" ,
7993 Description : "GitHub Notifications related tools" ,
94+ Icon : "bell" ,
8095 }
8196 ToolsetMetadataExperiments = registry.ToolsetMetadata {
8297 ID : "experiments" ,
8398 Description : "Experimental features that are not considered stable yet" ,
99+ Icon : "beaker" ,
84100 }
85101 ToolsetMetadataDiscussions = registry.ToolsetMetadata {
86102 ID : "discussions" ,
87103 Description : "GitHub Discussions related tools" ,
104+ Icon : "comment-discussion" ,
88105 }
89106 ToolsetMetadataGists = registry.ToolsetMetadata {
90107 ID : "gists" ,
91108 Description : "GitHub Gist related tools" ,
109+ Icon : "logo-gist" ,
92110 }
93111 ToolsetMetadataSecurityAdvisories = registry.ToolsetMetadata {
94112 ID : "security_advisories" ,
95113 Description : "Security advisories related tools" ,
114+ Icon : "shield" ,
96115 }
97116 ToolsetMetadataProjects = registry.ToolsetMetadata {
98117 ID : "projects" ,
99118 Description : "GitHub Projects related tools" ,
119+ Icon : "project" ,
100120 }
101121 ToolsetMetadataStargazers = registry.ToolsetMetadata {
102122 ID : "stargazers" ,
103123 Description : "GitHub Stargazers related tools" ,
124+ Icon : "star" ,
104125 }
105126 ToolsetMetadataDynamic = registry.ToolsetMetadata {
106127 ID : "dynamic" ,
107128 Description : "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." ,
129+ Icon : "tools" ,
108130 }
109131 ToolsetLabels = registry.ToolsetMetadata {
110132 ID : "labels" ,
111133 Description : "GitHub Labels related tools" ,
134+ Icon : "tag" ,
112135 }
113136)
114137
138+ func AvailableToolsets () []toolsets.ToolsetMetadata {
139+ return []toolsets.ToolsetMetadata {
140+ ToolsetMetadataContext ,
141+ ToolsetMetadataRepos ,
142+ ToolsetMetadataGit ,
143+ ToolsetMetadataIssues ,
144+ ToolsetMetadataPullRequests ,
145+ ToolsetMetadataUsers ,
146+ ToolsetMetadataOrgs ,
147+ ToolsetMetadataActions ,
148+ ToolsetMetadataCodeSecurity ,
149+ ToolsetMetadataSecretProtection ,
150+ ToolsetMetadataDependabot ,
151+ ToolsetMetadataNotifications ,
152+ ToolsetMetadataExperiments ,
153+ ToolsetMetadataDiscussions ,
154+ ToolsetMetadataGists ,
155+ ToolsetMetadataSecurityAdvisories ,
156+ ToolsetMetadataProjects ,
157+ ToolsetMetadataStargazers ,
158+ ToolsetMetadataDynamic ,
159+ ToolsetLabels ,
160+ }
161+ }
162+
163+ // GetValidToolsetIDs returns a map of all valid toolset IDs for quick lookup
164+ func GetValidToolsetIDs () map [toolsets.ToolsetID ]bool {
165+ validIDs := make (map [toolsets.ToolsetID ]bool )
166+ for _ , toolset := range AvailableToolsets () {
167+ validIDs [toolset .ID ] = true
168+ }
169+ // Add special keywords
170+ validIDs [ToolsetMetadataAll .ID ] = true
171+ validIDs [ToolsetMetadataDefault .ID ] = true
172+ return validIDs
173+ }
174+
175+ func GetDefaultToolsetIDs () []toolsets.ToolsetID {
176+ return []toolsets.ToolsetID {
177+ ToolsetMetadataContext .ID ,
178+ ToolsetMetadataRepos .ID ,
179+ ToolsetMetadataIssues .ID ,
180+ ToolsetMetadataPullRequests .ID ,
181+ ToolsetMetadataUsers .ID ,
182+ }
183+ }
184+
115185// AllTools returns all tools with their embedded toolset metadata.
116186// Tool functions return ServerTool directly with toolset info.
117187func AllTools (t translations.TranslationHelperFunc ) []registry.ServerTool {
@@ -274,8 +344,8 @@ func GenerateToolsetsHelp() string {
274344 }
275345 defaultTools := strings .Join (defaultStrings , ", " )
276346
277- // Get all available toolsets (excludes context and dynamic for display)
278- allToolsets := r . AvailableToolsets ("context" , "dynamic" )
347+ // Format available tools with line breaks for better readability
348+ allToolsets := AvailableToolsets ()
279349 var availableToolsLines []string
280350 const maxLineLength = 70
281351 currentLine := ""
@@ -311,10 +381,6 @@ func GenerateToolsetsHelp() string {
311381 return toolsetsHelp
312382}
313383
314- // stubTranslator is a passthrough translator for cases where we need a Registry
315- // but don't need actual translations (e.g., getting toolset IDs for CLI help).
316- func stubTranslator (_ , fallback string ) string { return fallback }
317-
318384// AddDefaultToolset removes the default toolset and expands it to the actual default toolset IDs
319385func AddDefaultToolset (result []string ) []string {
320386 hasDefault := false
@@ -343,6 +409,35 @@ func AddDefaultToolset(result []string) []string {
343409 return result
344410}
345411
412+ // cleanToolsets cleans and handles special toolset keywords:
413+ // - Duplicates are removed from the result
414+ // - Removes whitespaces
415+ // - Validates toolset names and returns invalid ones separately - for warning reporting
416+ // Returns: (toolsets, invalidToolsets)
417+ func CleanToolsets (enabledToolsets []string ) ([]string , []string ) {
418+ seen := make (map [string ]bool )
419+ result := make ([]string , 0 , len (enabledToolsets ))
420+ invalid := make ([]string , 0 )
421+ validIDs := GetValidToolsetIDs ()
422+
423+ // Add non-default toolsets, removing duplicates and trimming whitespace
424+ for _ , toolset := range enabledToolsets {
425+ trimmed := strings .TrimSpace (toolset )
426+ if trimmed == "" {
427+ continue
428+ }
429+ if ! seen [trimmed ] {
430+ seen [trimmed ] = true
431+ result = append (result , trimmed )
432+ if ! validIDs [toolsets .ToolsetID (trimmed )] {
433+ invalid = append (invalid , trimmed )
434+ }
435+ }
436+ }
437+
438+ return result , invalid
439+ }
440+
346441func RemoveToolset (tools []string , toRemove string ) []string {
347442 result := make ([]string , 0 , len (tools ))
348443 for _ , tool := range tools {
0 commit comments