findWorkflowsWithMCPServer searches for workflows containing a specific MCP server
(workflowsDir string, mcpServerName string, verbose bool)
| 107 | |
| 108 | // findWorkflowsWithMCPServer searches for workflows containing a specific MCP server |
| 109 | func findWorkflowsWithMCPServer(workflowsDir string, mcpServerName string, verbose bool) error { |
| 110 | // Scan workflows for MCP configurations, filtering by server name |
| 111 | results, err := ScanWorkflowsForMCP(workflowsDir, mcpServerName, verbose) |
| 112 | if err != nil { |
| 113 | return err |
| 114 | } |
| 115 | |
| 116 | var matchingWorkflows []string |
| 117 | |
| 118 | for _, result := range results { |
| 119 | // Check if this workflow contains the target MCP server |
| 120 | for _, config := range result.MCPConfigs { |
| 121 | if strings.EqualFold(config.Name, mcpServerName) { |
| 122 | matchingWorkflows = append(matchingWorkflows, result.BaseName) |
| 123 | break |
| 124 | } |
| 125 | } |
| 126 | } |
| 127 | |
| 128 | if len(matchingWorkflows) == 0 { |
| 129 | fmt.Fprintln(os.Stderr, console.FormatWarningMessage(fmt.Sprintf("MCP server '%s' not found in any workflow", mcpServerName))) |
| 130 | return nil |
| 131 | } |
| 132 | |
| 133 | // Display matching workflows and suggest using one |
| 134 | fmt.Fprintf(os.Stderr, "Found MCP server '%s' in %d workflow(s): %s\n", |
| 135 | mcpServerName, len(matchingWorkflows), strings.Join(matchingWorkflows, ", ")) |
| 136 | fmt.Fprintf(os.Stderr, "\nRun 'gh aw mcp list-tools <workflow-name> --server %s' to list tools for a specific workflow\n", mcpServerName) |
| 137 | |
| 138 | return nil |
| 139 | } |
| 140 | |
| 141 | // displayToolsList shows the tools available from the MCP server in a formatted table |
| 142 | func displayToolsList(info *parser.MCPServerInfo, verbose bool) { |