Class: KairosMcp::Tools::DefinitionVerify

Inherits:
BaseTool
  • Object
show all
Defined in:
lib/kairos_mcp/tools/definition_verify.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
# File 'lib/kairos_mcp/tools/definition_verify.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)

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

  unless skill.definition
    return text_content("## Verification: #{skill_id}\n\nThis skill has no definition block. Verification requires a structural definition layer.\n\nUse `skills_dsl_get` to view the skill's content layer.")
  end

  require_relative '../dsl_ast/ast_engine'
  report = DslAst::AstEngine.verify(skill)

  output = "## Verification Report: #{skill_id}\n\n"
  s = report.summary
  output += "**Summary**: #{s[:passed]} passed, #{s[:failed]} failed, #{s[:unknown]} unknown, #{s[:human_required]} human-required (#{s[:total]} total)\n\n"

  report.results.each do |r|
    icon = if !r.evaluable
             "\u{1f9d1}" # human emoji
           elsif r.satisfied == true
             "\u{2705}" # check mark
           elsif r.satisfied == false
             "\u{274c}" # cross
           else
             "\u{2753}" # question mark
           end
    output += "#{icon} **#{r.node_type}** `#{r.node_name}` — #{r.detail}\n"
  end

  if report.all_deterministic_passed?
    output += "\n**Status**: All deterministic constraints satisfied."
  else
    output += "\n**Status**: Some constraints not satisfied or not evaluable."
  end

  unless report.human_required.empty?
    output += "\n\n### Human Judgment Required\n"
    report.human_required.each do |r|
      output += "- `#{r.node_name}`: #{r.detail}\n"
    end
  end

  text_content(output)
end

#categoryObject



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

def category
  :skills
end

#descriptionObject



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

def description
  'Verify a skill\'s definition nodes against structural constraints. Reports which conditions pass, fail, or require human judgment.'
end

#examplesObject



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

def examples
  [
    {
      title: 'Verify core_safety definition',
      code: 'definition_verify(skill_id: "core_safety")'
    }
  ]
end

#input_schemaObject



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

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

#nameObject



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

def name
  'definition_verify'
end


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

def related_tools
  %w[definition_decompile definition_drift skills_dsl_get]
end

#usecase_tagsObject



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

def usecase_tags
  %w[verify definition AST constraint check validation]
end