@@ -146,18 +146,64 @@ func (c *CreateCommand) createAgentsFromYAML(agentsYaml []common.YAMLDocument) e
146146}
147147
148148// createMCPToolsFromYAML creates MCP tools from the YAML configuration
149- func (c * CreateCommand ) createMCPToolsFromYAML (agentsYaml []common.YAMLDocument ) error {
150- // In the Python implementation, this calls create_mcptools from maestro.mcptool
151- // We'll need to implement the equivalent functionality in Go
152-
149+ func (c * CreateCommand ) createMCPToolsFromYAML (toolsYaml []common.YAMLDocument ) error {
153150 // For now, we'll just print a message
154151 c .Console ().Ok ("Creating MCP tools from YAML configuration" )
155152
156- // TODO: Implement the actual MCP tool creation logic
157- // This would involve:
158- // 1. Parsing the tool definitions
159- // 2. Creating the tool instances
160- // 3. Registering them with the system
153+ // Get MCP server URI
154+ serverURI , err := common .GetMCPServerURI ("" )
155+ // serverURI, err := common.GetMaestroMCPServerURI(c.mcpServerURI)
156+ if err != nil {
157+ if common .Progress != nil {
158+ common .Progress .StopWithError ("Failed to get MCP server URI" )
159+ }
160+ return err
161+ }
162+
163+ if common .Verbose {
164+ fmt .Printf ("Connecting to MCP server at: %s\n " , serverURI )
165+ }
166+
167+ // Create MCP client
168+ client , _ := common .NewMCPClient (serverURI )
169+ if err != nil {
170+ if common .Progress != nil {
171+ common .Progress .StopWithError ("Failed to create MCP client" )
172+ }
173+ return err
174+ }
175+ defer client .Close ()
176+
177+ if common .Progress != nil {
178+ common .Progress .Update ("Executing create tools..." )
179+ }
180+
181+ // Call the run_workflow tool
182+ tool_strings , err := common .YamlToString (toolsYaml )
183+ if err != nil {
184+ fmt .Println ("tool file error" )
185+ }
186+
187+ params := map [string ]interface {}{
188+ "tools" : tool_strings ,
189+ }
190+
191+ result , err := client .CallMCPServer ("create_tools" , params )
192+ if err != nil {
193+ if common .Progress != nil {
194+ common .Progress .StopWithError ("Create tool failed" )
195+ }
196+ return err
197+ }
198+
199+ if common .Progress != nil {
200+ common .Progress .Stop ("Create tools completed successfully" )
201+ }
202+
203+ if ! common .Silent {
204+ fmt .Println ("OK" )
205+ }
206+ fmt .Println (result )
161207
162208 return nil
163209}
0 commit comments