MCPcopy Index your code
hub / github.com/github/gh-aw / GenerateMCPScriptShellToolScript

Function GenerateMCPScriptShellToolScript

pkg/workflow/mcp_scripts_generator.go:238–250  ·  view source on GitHub ↗

GenerateMCPScriptShellToolScript generates the shell script for a mcp-script tool

(toolConfig *MCPScriptToolConfig)

Source from the content-addressed store, hash-verified

236
237// GenerateMCPScriptShellToolScript generates the shell script for a mcp-script tool
238func GenerateMCPScriptShellToolScript(toolConfig *MCPScriptToolConfig) string {
239 mcpScriptsLog.Printf("Generating shell tool script: tool=%s", toolConfig.Name)
240 var sb strings.Builder
241
242 sb.WriteString("#!/bin/bash\n")
243 sb.WriteString("# Auto-generated mcp-script tool: " + toolConfig.Name + "\n")
244 sb.WriteString(formatMultiLineComment(toolConfig.Description, "# ") + "\n")
245 sb.WriteString("set +o histexpand\n")
246 sb.WriteString("set -euo pipefail\n\n")
247 sb.WriteString(toolConfig.Run + "\n")
248
249 return sb.String()
250}
251
252// GenerateMCPScriptPythonToolScript generates the Python script for a mcp-script tool
253// Python scripts receive inputs as a dictionary (parsed from JSON stdin):

Calls 3

formatMultiLineCommentFunction · 0.85
PrintfMethod · 0.45
StringMethod · 0.45