MCPcopy Create free account
hub / github.com/github/gh-aw / extractCustomArgs

Function extractCustomArgs

pkg/workflow/args.go:14–36  ·  view source on GitHub ↗

extractCustomArgs extracts custom args from tool configuration Handles both []any and []string formats

(toolConfig map[string]any)

Source from the content-addressed store, hash-verified

12// extractCustomArgs extracts custom args from tool configuration
13// Handles both []any and []string formats
14func 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
39func getGitHubCustomArgs(githubTool any) []string {

Callers 1

getGitHubCustomArgsFunction · 0.85

Calls 2

PrintMethod · 0.80
PrintfMethod · 0.45

Tested by

no test coverage detected