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

Function listWorkflowsWithMCP

pkg/cli/mcp_inspect_list.go:29–68  ·  view source on GitHub ↗

listWorkflowsWithMCP shows available workflow files that contain MCP configurations

(workflowsDir string, verbose bool)

Source from the content-addressed store, hash-verified

27
28// listWorkflowsWithMCP shows available workflow files that contain MCP configurations
29func listWorkflowsWithMCP(workflowsDir string, verbose bool) error {
30 mcpInspectListLog.Printf("Listing workflows with MCP servers: dir=%s, verbose=%v", workflowsDir, verbose)
31
32 // Scan workflows for MCP configurations
33 results, err := ScanWorkflowsForMCP(workflowsDir, "", verbose)
34 if err != nil {
35 if os.IsNotExist(err) {
36 errMsg := "no .github/workflows directory found"
37 fmt.Fprintln(os.Stderr, console.FormatErrorMessage(errMsg))
38 return errors.New("no .github/workflows directory found")
39 }
40 return err
41 }
42
43 mcpInspectListLog.Printf("Scanned %d workflows for MCP configurations", len(results))
44
45 // Filter out safe-outputs MCP servers for inspection
46 var workflowsWithMCP []string
47 for _, result := range results {
48 filteredConfigs := filterOutSafeOutputs(result.MCPConfigs)
49 if len(filteredConfigs) > 0 {
50 workflowsWithMCP = append(workflowsWithMCP, result.FileName)
51 }
52 }
53
54 if len(workflowsWithMCP) == 0 {
55 fmt.Fprintln(os.Stderr, console.FormatInfoMessage("No workflows with MCP servers found"))
56 return nil
57 }
58
59 mcpInspectListLog.Printf("Found %d workflows with MCP servers", len(workflowsWithMCP))
60 fmt.Fprintln(os.Stderr, console.FormatInfoMessage("No workflow specified; showing MCP summary list (same behavior as 'gh aw mcp list')."))
61 fmt.Fprintln(os.Stderr, console.FormatInfoMessage("Workflows with MCP servers:"))
62 for _, workflow := range workflowsWithMCP {
63 fmt.Fprintf(os.Stderr, " • %s\n", workflow)
64 }
65 fmt.Fprintf(os.Stderr, "\nRun 'gh aw mcp inspect <workflow-name>' to inspect MCP servers in a specific workflow.\n")
66
67 return nil
68}

Callers 1

InspectWorkflowMCPFunction · 0.85

Calls 5

FormatErrorMessageFunction · 0.92
FormatInfoMessageFunction · 0.92
ScanWorkflowsForMCPFunction · 0.85
filterOutSafeOutputsFunction · 0.85
PrintfMethod · 0.45

Tested by

no test coverage detected