Class: KairosMcp::Tools::SkillsEvolve

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/kairos_mcp/tools/skills_evolve.rb

Instance Method Summary collapse

Methods inherited from BaseTool

#initialize, #invoke_tool, #to_full_schema, #to_schema

Constructor Details

This class inherits a constructor from KairosMcp::Tools::BaseTool

Instance Method Details

#call(arguments) ⇒ Object



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/kairos_mcp/tools/skills_evolve.rb', line 73

def call(arguments)
  command = arguments['command'] || 'propose'
  skill_id = arguments['skill_id']
  definition = arguments['definition']
  reason = arguments['reason']
  approved = arguments['approved'] || false

  case command
  when 'propose'
    return text_content("Error: skill_id and definition are required") unless skill_id && definition
    
    result = SafeEvolver.propose(skill_id: skill_id, new_definition: definition, reason: reason)
    format_result(result, show_checks: true)

  when 'apply'
    return text_content("Error: skill_id and definition are required") unless skill_id && definition
    
    result = SafeEvolver.apply(skill_id: skill_id, new_definition: definition, approved: approved)
    format_result(result)

  when 'add'
    return text_content("Error: skill_id and definition are required") unless skill_id && definition
    
    result = SafeEvolver.add_skill(skill_id: skill_id, definition: definition, approved: approved)
    format_result(result)

  when 'reset'
    SafeEvolver.reset_session!
    text_content("Evolution session counter reset.")

  else
    text_content("Unknown command: #{command}")
  end
end

#categoryObject



15
16
17
# File 'lib/kairos_mcp/tools/skills_evolve.rb', line 15

def category
  :skills
end

#descriptionObject



11
12
13
# File 'lib/kairos_mcp/tools/skills_evolve.rb', line 11

def description
  'Propose and apply changes to Skills DSL definitions. Runs L0 auto-check and records changes to KairosChain.'
end

#examplesObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/kairos_mcp/tools/skills_evolve.rb', line 23

def examples
  [
    {
      title: 'Propose a change',
      code: 'skills_evolve(command: "propose", skill_id: "my_skill", definition: "skill :my_skill do ... end", reason: "Add new feature")'
    },
    {
      title: 'Apply with approval',
      code: 'skills_evolve(command: "apply", skill_id: "my_skill", definition: "...", approved: true)'
    },
    {
      title: 'Add new skill',
      code: 'skills_evolve(command: "add", skill_id: "new_skill", definition: "...", approved: true)'
    }
  ]
end

#input_schemaObject



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/kairos_mcp/tools/skills_evolve.rb', line 44

def input_schema
  {
    type: 'object',
    properties: {
      command: {
        type: 'string',
        description: 'Command: "propose", "apply", "add", or "reset"',
        enum: ['propose', 'apply', 'add', 'reset']
      },
      skill_id: {
        type: 'string',
        description: 'ID of the skill to modify or add'
      },
      definition: {
        type: 'string',
        description: 'New skill definition (Ruby DSL code)'
      },
      reason: {
        type: 'string',
        description: 'Reason for the change (documented for traceability)'
      },
      approved: {
        type: 'boolean',
        description: 'Set to true to approve the change (when human approval is required)'
      }
    }
  }
end

#nameObject



7
8
9
# File 'lib/kairos_mcp/tools/skills_evolve.rb', line 7

def name
  'skills_evolve'
end


40
41
42
# File 'lib/kairos_mcp/tools/skills_evolve.rb', line 40

def related_tools
  %w[skills_rollback skills_dsl_list skills_dsl_get chain_history]
end

#usecase_tagsObject



19
20
21
# File 'lib/kairos_mcp/tools/skills_evolve.rb', line 19

def usecase_tags
  %w[evolve modify L0 meta-skill change propose apply blockchain]
end