You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Add global flags that will be shared by all commands
107
+
rootCmd.PersistentFlags().StringSlice("features", []string{"repos", "issues", "pull_requests", "search"}, "A comma separated list of groups of tools to enable, defaults to issues/repos/search")
64
108
rootCmd.PersistentFlags().Bool("read-only", false, "Restrict the server to read-only operations")
65
109
rootCmd.PersistentFlags().String("log-file", "", "Path to log file")
66
110
rootCmd.PersistentFlags().Bool("enable-command-logging", false, "When enabled, the server will log all command requests and responses to the log file")
67
111
rootCmd.PersistentFlags().Bool("export-translations", false, "Save translations to a JSON file")
68
112
rootCmd.PersistentFlags().String("gh-host", "", "Specify the GitHub hostname (for GitHub Enterprise etc.)")
@@ -143,6 +159,46 @@ func OptionalParamOK[T any](r mcp.CallToolRequest, p string) (value T, ok bool,
143
159
return
144
160
}
145
161
162
+
funcEnableToolset(toolsets*toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
163
+
returnmcp.NewTool("enable_toolset",
164
+
mcp.WithDescription(t("TOOL_LIST_AVAILABLE_FEATURES_DESCRIPTION", "List all available features this MCP server can offer, providing the enabled status of each.")),
// We need to convert the toolsets back to a map for JSON serialization
168
+
featureMap:=make(map[string]bool)
169
+
forname:=rangetoolsets.Toolsets {
170
+
featureMap[name] =toolsets.IsEnabled(name)
171
+
}
172
+
173
+
r, err:=json.Marshal(featureMap)
174
+
iferr!=nil {
175
+
returnnil, fmt.Errorf("failed to marshal features: %w", err)
176
+
}
177
+
178
+
returnmcp.NewToolResultText(string(r)), nil
179
+
}
180
+
}
181
+
182
+
funcListAvailableToolsets(toolsetGroup*toolsets.ToolsetGroup, t translations.TranslationHelperFunc) (tool mcp.Tool, handler server.ToolHandlerFunc) {
183
+
returnmcp.NewTool("list_available_toolsets",
184
+
mcp.WithDescription(t("TOOL_LIST_AVAILABLE_FEATURES_DESCRIPTION", "List all available toolsets this MCP server can offer, providing the enabled status of each.")),
0 commit comments