Class: KairosMcp::Tools::SkillsDslGet

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/kairos_mcp/tools/skills_dsl_get.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



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
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
107
# File 'lib/kairos_mcp/tools/skills_dsl_get.rb', line 49

def call(arguments)
  skill_id = arguments['skill_id']
  return text_content("Error: skill_id is required") unless skill_id && !skill_id.empty?

  provider = DslSkillsProvider.new
  skill = provider.get_skill(skill_id)

  if skill.nil?
    available = provider.list_skills.map { |s| s[:id] }.join(', ')
    return text_content("Skill '#{skill_id}' not found. Available: #{available}")
  end

  output = "## [#{skill.id}] #{skill.title}\n"
  output += "**Version:** #{skill.version}\n" if skill.version
  output += "**Use When:** #{skill.use_when}\n" if skill.use_when
  output += "**Requires:** #{skill.requires}\n" if skill.requires
  output += "**Guarantees:** #{skill.guarantees}\n" if skill.guarantees
  output += "**Depends On:** #{skill.depends_on}\n" if skill.depends_on
  output += "\n---\n\n"
  output += "### Content (Natural Language Layer)\n\n"
  output += skill.content || "(No content)"

  # Structural layer (definition)
  if skill.definition
    output += "\n\n---\n\n### Definition (Structural Layer)\n\n"
    skill.definition.nodes.each do |node|
      output += "- **#{node.type}** `:#{node.name}`"
      if node.options && !node.options.empty?
        opts = node.options.map { |k, v| "#{k}: #{v}" }.join(', ')
        output += "#{opts}"
      end
      output += "\n"
    end
  end

  # Provenance layer (formalization_notes)
  if skill.formalization_notes
    output += "\n---\n\n### Formalization Notes (Provenance Layer)\n\n"
    output += skill.formalization_notes
  end

  # Verification status (Phase 2: requires dsl_ast module)
  if skill.definition
    begin
      require_relative '../dsl_ast/ast_engine'
      report = DslAst::AstEngine.verify(skill)
      if report
        s = report.summary
        output += "\n---\n\n### Verification Status\n\n"
        status = report.all_deterministic_passed? ? "PASS" : "ISSUES"
        output += "**#{status}**: #{s[:passed]} passed, #{s[:failed]} failed, #{s[:unknown]} unknown, #{s[:human_required]} human-required\n"
      end
    rescue LoadError, NameError
      # dsl_ast module not loaded — skip verification section
    end
  end

  text_content(output)
end

#categoryObject



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

def category
  :skills
end

#descriptionObject



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

def description
  'Get the detailed content and metadata of a specific DSL skill by ID.'
end

#examplesObject



23
24
25
26
27
28
29
30
# File 'lib/kairos_mcp/tools/skills_dsl_get.rb', line 23

def examples
  [
    {
      title: 'Get DSL skill details',
      code: 'skills_dsl_get(skill_id: "core_safety")'
    }
  ]
end

#input_schemaObject



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/kairos_mcp/tools/skills_dsl_get.rb', line 36

def input_schema
  {
    type: 'object',
    properties: {
      skill_id: {
        type: 'string',
        description: 'The skill ID to retrieve'
      }
    },
    required: ['skill_id']
  }
end

#nameObject



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

def name
  'skills_dsl_get'
end


32
33
34
# File 'lib/kairos_mcp/tools/skills_dsl_get.rb', line 32

def related_tools
  %w[skills_dsl_list skills_evolve skills_get]
end

#usecase_tagsObject



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

def usecase_tags
  %w[get read L0 DSL skill detail content]
end