PrettifyToolName removes "mcp__" prefix and formats tool names nicely
(toolName string)
| 195 | |
| 196 | // PrettifyToolName removes "mcp__" prefix and formats tool names nicely |
| 197 | func PrettifyToolName(toolName string) string { |
| 198 | // Handle MCP tools: "mcp__github__search_issues" -> "github_search_issues" |
| 199 | // Avoid colons and leave underscores as-is |
| 200 | if strings.HasPrefix(toolName, "mcp__") { |
| 201 | parts := strings.Split(toolName, "__") |
| 202 | if len(parts) >= 3 { |
| 203 | provider := parts[1] |
| 204 | method := strings.Join(parts[2:], "_") |
| 205 | return fmt.Sprintf("%s_%s", provider, method) |
| 206 | } |
| 207 | // If format is unexpected, just remove the mcp__ prefix |
| 208 | return strings.TrimPrefix(toolName, "mcp__") |
| 209 | } |
| 210 | |
| 211 | // Handle bash specially - keep as "bash" |
| 212 | if strings.EqualFold(toolName, "bash") { |
| 213 | return "bash" |
| 214 | } |
| 215 | |
| 216 | // Return other tool names as-is |
| 217 | return toolName |
| 218 | } |
| 219 | |
| 220 | // SanitizeWorkflowIDForCacheKey sanitizes a workflow ID for use in cache keys. |
| 221 | // It removes all hyphens and converts to lowercase to create a filesystem-safe identifier. |
no outgoing calls