Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1220,6 +1220,52 @@ spec:
./maestro workflow deploy agent-config.yaml workflow-config.yaml --dry-run
```

## Tool Management

The Maestro CLI provides commands for creating Tools for agents.

### Create Tool

```bash
# Create tool from YAML
./maestro tool create tool-config.yaml

# Test without creating (dry run)
./maestro tool create tool-config.yaml --dry-run
```

The command automatically:
- Sets the API version to `maestro.ai4quantum.com/v1alpha1`
- Sanitizes resource names for Kubernetes compatibility
- Processes workflow-specific fields for proper deployment

### Tool Examples
Tool example defined in yaml format is:
```yaml
apiVersion: maestro/v1alpha1
kind: MCPTool
metadata:
name: fetch
namespace: default
spec:
image: ghcr.io/stackloklabs/gofetch/server:latest
transport: streamable-http
```
The syntax of the agent definition is defined in the [json schema](https://github.com/AI4quantum/maestro/blob/main/schemas/tool_schema.json).
The schema is same as ToolHive CRD definition except `apiVersion` and `kind`.
Maestro deploy MCP servers for the defined tools. The available tools are listed by [ToolHive `thv list`](https://docs.stacklok.com/toolhive/reference/cli/thv_list) command.

- **apiVersion**: version of agent definition format. This must be `maestro/v1alpha1` now.
- **kind**: type of object. `MCPTool` for agent definition
- **metadata**:
- **name**: name of tool
- **labels**: array of key, value pairs. This is optional and can be used to associate any information to this agent
- **spec**:
- **image**: Image is the container image for the MCP server. The image location is in [`thv registry info [server] [flags]`](https://docs.stacklok.com/toolhive/reference/cli/thv_registry_info) output
- **transport**: Transport is the transport method for the MCP server (stdio, streamable-http, sse)

The full schema is documeted in [ToolHive Docs](https://docs.stacklok.com/toolhive/reference/crd-spec)

## Custom Resource Management

The CLI provides commands for creating Kubernetes custom resources:
Expand Down
47 changes: 47 additions & 0 deletions docs/USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Welcome to the Maestro CLI! This guide will help you get started with managing v
- [Document Management](#document-management)
- [Agent Management](#agent-management)
- [Workflow Management](#workflow-management)
- [Tool Management](#tool-management)
- [Custom Resource Management](#custom-resource-management)
- [Mermaid Diagram Generation](#mermaid-diagram-generation)
- [Validation](#validation)
Expand Down Expand Up @@ -357,6 +358,52 @@ spec:
./maestro workflow deploy agent-config.yaml workflow-config.yaml --dry-run
```

## Tool Management

The Maestro CLI provides commands for creating Tools for agents.

### Create Tool

```bash
# Create tool from YAML
./maestro tool create tool-config.yaml

# Test without creating (dry run)
./maestro tool create tool-config.yaml --dry-run
```

The command automatically:
- Sets the API version to `maestro.ai4quantum.com/v1alpha1`
- Sanitizes resource names for Kubernetes compatibility
- Processes workflow-specific fields for proper deployment

### Tool Examples
Tool example defined in yaml format is:
```yaml
apiVersion: maestro/v1alpha1
kind: MCPTool
metadata:
name: fetch
namespace: default
spec:
image: ghcr.io/stackloklabs/gofetch/server:latest
transport: streamable-http
```
The syntax of the agent definition is defined in the [json schema](https://github.com/AI4quantum/maestro/blob/main/schemas/tool_schema.json).
The schema is same as ToolHive CRD definition except `apiVersion` and `kind`.
Maestro deploy MCP servers for the defined tools. The available tools are listed by [ToolHive `thv list`](https://docs.stacklok.com/toolhive/reference/cli/thv_list) command.

- **apiVersion**: version of agent definition format. This must be `maestro/v1alpha1` now.
- **kind**: type of object. `MCPTool` for agent definition
- **metadata**:
- **name**: name of tool
- **labels**: array of key, value pairs. This is optional and can be used to associate any information to this agent
- **spec**:
- **image**: Image is the container image for the MCP server. The image location is in [`thv registry info [server] [flags]`](https://docs.stacklok.com/toolhive/reference/cli/thv_registry_info) output
- **transport**: Transport is the transport method for the MCP server (stdio, streamable-http, sse)

The full schema is documeted in [ToolHive Docs](https://docs.stacklok.com/toolhive/reference/crd-spec)

## Custom Resource Management

The Maestro CLI provides commands for creating Kubernetes custom resources for agents and workflows.
Expand Down
63 changes: 54 additions & 9 deletions internal/commands/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,18 +146,63 @@ func (c *CreateCommand) createAgentsFromYAML(agentsYaml []common.YAMLDocument) e
}

// createMCPToolsFromYAML creates MCP tools from the YAML configuration
func (c *CreateCommand) createMCPToolsFromYAML(agentsYaml []common.YAMLDocument) error {
// In the Python implementation, this calls create_mcptools from maestro.mcptool
// We'll need to implement the equivalent functionality in Go

func (c *CreateCommand) createMCPToolsFromYAML(toolsYaml []common.YAMLDocument) error {
// For now, we'll just print a message
c.Console().Ok("Creating MCP tools from YAML configuration")

// TODO: Implement the actual MCP tool creation logic
// This would involve:
// 1. Parsing the tool definitions
// 2. Creating the tool instances
// 3. Registering them with the system
// Get MCP server URI
serverURI, err := common.GetMaestroMCPServerURI(c.mcpServerURI)
if err != nil {
if common.Progress != nil {
common.Progress.StopWithError("Failed to get MCP server URI")
}
return err
}

if common.Verbose {
fmt.Printf("Connecting to MCP server at: %s\n", serverURI)
}

// Create MCP client
client, _ := common.NewMCPClient(serverURI)
if err != nil {
if common.Progress != nil {
common.Progress.StopWithError("Failed to create MCP client")
}
return err
}
defer client.Close()

if common.Progress != nil {
common.Progress.Update("Executing create tools...")
}

// Call the run_workflow tool
tool_strings, err := common.YamlToString(toolsYaml)
if err != nil {
fmt.Println("tool file error")
}

params := map[string]interface{}{
"tools": tool_strings,
}

result, err := client.CallMCPServer("create_tools", params)
if err != nil {
if common.Progress != nil {
common.Progress.StopWithError("Create tool failed")
}
return err
}

if common.Progress != nil {
common.Progress.Stop("Create tools completed successfully")
}

if !common.Silent {
fmt.Println("OK")
}
fmt.Println(result)

return nil
}
13 changes: 11 additions & 2 deletions src/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ var agentCmd = &cobra.Command{
Short: "Manage agents",
Long: `Manage agent including creating, and serving.`,
Aliases: []string{"agent"},
Example: ` maestro create agents.yaml
maestro agent create agents.yaml`,
Example: ` maestro agent create agents.yaml
maestro agent serve agents.yaml`,
}

// Workflow commands - run, serve, deploy
Expand All @@ -367,6 +367,15 @@ var workflowCmd = &cobra.Command{
maestro workflow deploy agents.yaml workflow.yaml`,
}

// Tool commands - create
var toolCmd = &cobra.Command{
Use: "tool",
Short: "Manage tools",
Long: `Manage tool including creating.`,
Aliases: []string{"tool"},
Example: ` maestro tool create tools.yaml`,
}

// CustomResource commands - create
var customResourceCmd = &cobra.Command{
Use: "customresource",
Expand Down
3 changes: 3 additions & 0 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ A command-line interface for working with Maestro configurations.`,
)
rootCmd.AddCommand(agentCmd)
rootCmd.AddCommand(workflowCmd)
rootCmd.AddCommand(toolCmd)
rootCmd.AddCommand(customResourceCmd)
rootCmd.AddCommand(metaAgentCmd)
rootCmd.AddCommand(vdbCmd)
Expand Down Expand Up @@ -163,6 +164,8 @@ A command-line interface for working with Maestro configurations.`,
workflowCmd.AddCommand(commands.NewRunCommand())
workflowCmd.AddCommand(commands.NewDeployCommand())

toolCmd.AddCommand(commands.NewCreateCommand())

customResourceCmd.AddCommand(commands.NewCreateCrCommand())

// Chunking
Expand Down
Loading