44 "context"
55 "fmt"
66 "log/slog"
7+ "slices"
78
89 "github.com/goccy/go-yaml"
910
@@ -116,6 +117,10 @@ func validateConfig(cfg *latest.Config) error {
116117 return fmt .Errorf ("agent '%s' references non-existent sub-agent '%s'" , agentName , subAgentName )
117118 }
118119 }
120+
121+ if err := validateSkillsConfiguration (agentName , & agent ); err != nil {
122+ return err
123+ }
119124 }
120125
121126 return nil
@@ -124,3 +129,44 @@ func validateConfig(cfg *latest.Config) error {
124129func boolPtr (b bool ) * bool {
125130 return & b
126131}
132+
133+ // validateSkillsConfiguration ensures that agents with skills enabled have the necessary tools
134+ func validateSkillsConfiguration (agentName string , agent * latest.AgentConfig ) error {
135+ // Check if skills are enabled
136+ if agent .Skills == nil || ! * agent .Skills {
137+ return nil
138+ }
139+
140+ // Skills are enabled, validate toolsets
141+ hasFilesystemToolset := false
142+ hasReadFileTool := false
143+
144+ for _ , toolset := range agent .Toolsets {
145+ if toolset .Type == "filesystem" {
146+ hasFilesystemToolset = true
147+
148+ // Check if read_file tool is enabled
149+ // If no specific tools are listed, all tools are enabled
150+ if len (toolset .Tools ) == 0 {
151+ hasReadFileTool = true
152+ break
153+ }
154+
155+ // Check if read_file is in the tools list
156+ if slices .Contains (toolset .Tools , "read_file" ) {
157+ hasReadFileTool = true
158+ break
159+ }
160+ }
161+ }
162+
163+ if ! hasFilesystemToolset {
164+ return fmt .Errorf ("agent '%s' has skills enabled but does not have a 'filesystem' toolset configured" , agentName )
165+ }
166+
167+ if ! hasReadFileTool {
168+ return fmt .Errorf ("agent '%s' has skills enabled but the 'filesystem' toolset does not include the 'read_file' tool" , agentName )
169+ }
170+
171+ return nil
172+ }
0 commit comments