// internal/skills/spec/skill.go package spec import ( "context" "encoding/json" "github.com/mathiasbq/supervisor/internal/registry" ) // CompleteFunc is the function used to call a local model. type CompleteFunc func(ctx context.Context, model, system, user string) (string, int64, error) // Config holds dependencies for the spec skill. type Config struct { SkillPrompt string DefaultModel string CompleteFunc CompleteFunc SessionsDir string IngestBaseURL string } // Skill implements the spec MCP tool. type Skill struct{ cfg Config } // New creates a new spec Skill. func New(cfg Config) *Skill { return &Skill{cfg: cfg} } // Name returns the skill identifier. func (s *Skill) Name() string { return "spec" } // Tools returns the MCP tool definitions for this skill. func (s *Skill) Tools() []registry.ToolDef { schema := func(required []string, props map[string]any) json.RawMessage { b, _ := json.Marshal(map[string]any{"type": "object", "required": required, "properties": props}) return b } str := map[string]any{"type": "string"} return []registry.ToolDef{ { Name: "spec", Description: "Consult a local model to draft a structured implementation spec from requirements. Returns the spec text.", InputSchema: schema( []string{"project_root", "requirements"}, map[string]any{ "project_root": str, "requirements": str, "output_path": str, "context": str, "model": str, "session_id": str, }, ), }, } }