extractCustomArgs extracts custom args from tool configuration Handles both []any and []string formats
(toolConfig map[string]any)
| 12 | // extractCustomArgs extracts custom args from tool configuration |
| 13 | // Handles both []any and []string formats |
| 14 | func extractCustomArgs(toolConfig map[string]any) []string { |
| 15 | if argsValue, exists := toolConfig["args"]; exists { |
| 16 | argsLog.Print("Extracting custom args from tool configuration") |
| 17 | |
| 18 | // Handle []any format |
| 19 | if argsSlice, ok := argsValue.([]any); ok { |
| 20 | customArgs := make([]string, 0, len(argsSlice)) |
| 21 | for _, arg := range argsSlice { |
| 22 | if argStr, ok := arg.(string); ok { |
| 23 | customArgs = append(customArgs, argStr) |
| 24 | } |
| 25 | } |
| 26 | argsLog.Printf("Extracted %d args from []any format", len(customArgs)) |
| 27 | return customArgs |
| 28 | } |
| 29 | // Handle []string format |
| 30 | if argsSlice, ok := argsValue.([]string); ok { |
| 31 | argsLog.Printf("Extracted %d args from []string format", len(argsSlice)) |
| 32 | return argsSlice |
| 33 | } |
| 34 | } |
| 35 | return nil |
| 36 | } |
| 37 | |
| 38 | // getGitHubCustomArgs extracts custom args from GitHub tool configuration |
| 39 | func getGitHubCustomArgs(githubTool any) []string { |
no test coverage detected