on main help sign in
fix: simpler
commit820e55ebbab2c9407e272dfcda3f077bb7022d65 authorCarlos Alexandro Becker <caarlos0@users.noreply.github.com> dateMon 28 Jul 2025, 22:47 (1 year ago) parent3135b6f
2 files changed+9−34
internal/config/config.go+1−22 schema.json+8−12
internal/config/config.go+1−22
@@ -13,7 +13,6 @@ import (
1313 "github.com/charmbracelet/catwalk/pkg/catwalk"
1414 "github.com/charmbracelet/crush/internal/csync"
1515 "github.com/charmbracelet/crush/internal/env"
16− "github.com/invopop/jsonschema"
1716 "github.com/tidwall/sjson"
1817)
1918
@@ -46,16 +45,6 @@ const (
4645 SelectedModelTypeSmall SelectedModelType = "small"
4746)
4847
49−// JSONSchema returns the JSON schema for SelectedModelType
50−func (SelectedModelType) JSONSchema() *jsonschema.Schema {
51− return &jsonschema.Schema{
52− Type: "string",
53− Description: "Model type selection for different use cases",
54− Enum: []any{"large", "small"},
55− Default: "large",
56− }
57−}
58−
5948type SelectedModel struct {
6049 // The model id as used by the provider API.
6150 // Required.
@@ -111,16 +100,6 @@ const (
111100 MCPHttp MCPType = "http"
112101)
113102
114−// JSONSchema returns the JSON schema for MCPType
115−func (MCPType) JSONSchema() *jsonschema.Schema {
116− return &jsonschema.Schema{
117− Type: "string",
118− Description: "Type of MCP connection protocol",
119− Enum: []any{"stdio", "sse", "http"},
120− Default: "stdio",
121− }
122−}
123−
124103type MCPConfig struct {
125104 Command string `json:"command,omitempty" jsonschema:"description=Command to execute for stdio MCP servers,example=npx"`
126105 Env map[string]string `json:"env,omitempty" jsonschema:"description=Environment variables to set for the MCP server"`
@@ -239,7 +218,7 @@ type Agent struct {
239218 // This is the id of the system prompt used by the agent
240219 Disabled bool `json:"disabled,omitempty"`
241220
242− Model SelectedModelType `json:"model"`
221+ Model SelectedModelType `json:"model" jsonschema:"required,description=The model type to use for this agent,enum=large,enum=small,default=large"`
243222
244223 // The available tools for the agent
245224 // if this is nil, all tools are available
schema.json+8−12
@@ -100,8 +100,14 @@
100100 "description": "Arguments to pass to the MCP server command"
101101 },
102102 "type": {
103− "$ref": "#/$defs/MCPType",
104− "description": "Type of MCP connection"
103+ "type": "string",
104+ "enum": [
105+ "stdio",
106+ "sse",
107+ "http"
108+ ],
109+ "description": "Type of MCP connection",
110+ "default": "stdio"
105111 },
106112 "url": {
107113 "type": "string",
@@ -130,16 +136,6 @@
130136 "type"
131137 ]
132138 },
133− "MCPType": {
134− "type": "string",
135− "enum": [
136− "stdio",
137− "sse",
138− "http"
139− ],
140− "description": "Type of MCP connection protocol",
141− "default": "stdio"
142− },
143139 "MCPs": {
144140 "additionalProperties": {
145141 "$ref": "#/$defs/MCPConfig"