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

Function findWorkflowsWithMCPServer

pkg/cli/mcp_list_tools.go:109–139  ·  view source on GitHub ↗

findWorkflowsWithMCPServer searches for workflows containing a specific MCP server

(workflowsDir string, mcpServerName string, verbose bool)

Source from the content-addressed store, hash-verified

107
108// findWorkflowsWithMCPServer searches for workflows containing a specific MCP server
109func 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
142func displayToolsList(info *parser.MCPServerInfo, verbose bool) {

Callers 2

ListToolsForMCPFunction · 0.85

Calls 2

FormatWarningMessageFunction · 0.92
ScanWorkflowsForMCPFunction · 0.85

Tested by 1