Skip to content

Commit 67df381

Browse files
Refactor formatToolsetName to shared helper function
Co-authored-by: SamMorrowDrums <[email protected]>
1 parent 9be3315 commit 67df381

File tree

2 files changed

+1
-49
lines changed

2 files changed

+1
-49
lines changed

cmd/github-mcp-server/generate_docs.go

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -198,30 +198,6 @@ func generateToolsDoc(r *inventory.Inventory) string {
198198
return buf.String()
199199
}
200200

201-
func formatToolsetName(name string) string {
202-
switch name {
203-
case "pull_requests":
204-
return "Pull Requests"
205-
case "repos":
206-
return "Repositories"
207-
case "code_security":
208-
return "Code Security"
209-
case "secret_protection":
210-
return "Secret Protection"
211-
case "orgs":
212-
return "Organizations"
213-
default:
214-
// Fallback: capitalize first letter and replace underscores with spaces
215-
parts := strings.Split(name, "_")
216-
for i, part := range parts {
217-
if len(part) > 0 {
218-
parts[i] = strings.ToUpper(string(part[0])) + part[1:]
219-
}
220-
}
221-
return strings.Join(parts, " ")
222-
}
223-
}
224-
225201
func writeToolDoc(buf *strings.Builder, tool inventory.ServerTool) {
226202
// Tool name (no icon - section header already has the toolset icon)
227203
fmt.Fprintf(buf, "- **%s** - %s\n", tool.Tool.Name, tool.Tool.Annotations.Title)

cmd/github-mcp-server/list_scopes.go

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ func outputText(output ScopesOutput) error {
249249

250250
for _, toolsetName := range toolsetNames {
251251
tools := toolsByToolset[toolsetName]
252-
fmt.Printf("## %s\n\n", formatToolsetNameForOutput(toolsetName))
252+
fmt.Printf("## %s\n\n", formatToolsetName(toolsetName))
253253

254254
for _, tool := range tools {
255255
rwIndicator := "📝"
@@ -289,27 +289,3 @@ func outputText(output ScopesOutput) error {
289289

290290
return nil
291291
}
292-
293-
func formatToolsetNameForOutput(name string) string {
294-
switch name {
295-
case "pull_requests":
296-
return "Pull Requests"
297-
case "repos":
298-
return "Repositories"
299-
case "code_security":
300-
return "Code Security"
301-
case "secret_protection":
302-
return "Secret Protection"
303-
case "orgs":
304-
return "Organizations"
305-
default:
306-
// Capitalize first letter and replace underscores with spaces
307-
parts := strings.Split(name, "_")
308-
for i, part := range parts {
309-
if len(part) > 0 {
310-
parts[i] = strings.ToUpper(string(part[0])) + part[1:]
311-
}
312-
}
313-
return strings.Join(parts, " ")
314-
}
315-
}

0 commit comments

Comments
 (0)