fix: simpler

Carlos Alexandro Becker created

Change summary

internal/config/config.go | 23 +----------------------
schema.json               | 20 ++++++++------------
2 files changed, 9 insertions(+), 34 deletions(-)

Detailed changes

internal/config/config.go 🔗

@@ -13,7 +13,6 @@ import (
 	"github.com/charmbracelet/catwalk/pkg/catwalk"
 	"github.com/charmbracelet/crush/internal/csync"
 	"github.com/charmbracelet/crush/internal/env"
-	"github.com/invopop/jsonschema"
 	"github.com/tidwall/sjson"
 )
 
@@ -46,16 +45,6 @@ const (
 	SelectedModelTypeSmall SelectedModelType = "small"
 )
 
-// JSONSchema returns the JSON schema for SelectedModelType
-func (SelectedModelType) JSONSchema() *jsonschema.Schema {
-	return &jsonschema.Schema{
-		Type:        "string",
-		Description: "Model type selection for different use cases",
-		Enum:        []any{"large", "small"},
-		Default:     "large",
-	}
-}
-
 type SelectedModel struct {
 	// The model id as used by the provider API.
 	// Required.
@@ -111,16 +100,6 @@ const (
 	MCPHttp  MCPType = "http"
 )
 
-// JSONSchema returns the JSON schema for MCPType
-func (MCPType) JSONSchema() *jsonschema.Schema {
-	return &jsonschema.Schema{
-		Type:        "string",
-		Description: "Type of MCP connection protocol",
-		Enum:        []any{"stdio", "sse", "http"},
-		Default:     "stdio",
-	}
-}
-
 type MCPConfig struct {
 	Command  string            `json:"command,omitempty" jsonschema:"description=Command to execute for stdio MCP servers,example=npx"`
 	Env      map[string]string `json:"env,omitempty" jsonschema:"description=Environment variables to set for the MCP server"`
@@ -239,7 +218,7 @@ type Agent struct {
 	// This is the id of the system prompt used by the agent
 	Disabled bool `json:"disabled,omitempty"`
 
-	Model SelectedModelType `json:"model"`
+	Model SelectedModelType `json:"model" jsonschema:"required,description=The model type to use for this agent,enum=large,enum=small,default=large"`
 
 	// The available tools for the agent
 	//  if this is nil, all tools are available

schema.json 🔗

@@ -100,8 +100,14 @@
           "description": "Arguments to pass to the MCP server command"
         },
         "type": {
-          "$ref": "#/$defs/MCPType",
-          "description": "Type of MCP connection"
+          "type": "string",
+          "enum": [
+            "stdio",
+            "sse",
+            "http"
+          ],
+          "description": "Type of MCP connection",
+          "default": "stdio"
         },
         "url": {
           "type": "string",
@@ -130,16 +136,6 @@
         "type"
       ]
     },
-    "MCPType": {
-      "type": "string",
-      "enum": [
-        "stdio",
-        "sse",
-        "http"
-      ],
-      "description": "Type of MCP connection protocol",
-      "default": "stdio"
-    },
     "MCPs": {
       "additionalProperties": {
         "$ref": "#/$defs/MCPConfig"