Class: KairosMcp::Tools::DefinitionDecompile
- Inherits:
-
BaseTool
- Object
- BaseTool
- KairosMcp::Tools::DefinitionDecompile
show all
- Defined in:
- lib/kairos_mcp/tools/definition_decompile.rb
Instance Method Summary
collapse
Methods inherited from BaseTool
#initialize, #invoke_tool, #to_full_schema, #to_schema
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
|
# File 'lib/kairos_mcp/tools/definition_decompile.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("## Decompile: #{skill_id}\n\nThis skill has no definition block to decompile.\nThe skill exists only as natural language content.")
end
require_relative '../dsl_ast/decompiler'
markdown = DslAst::Decompiler.decompile(skill.definition)
output = "## Decompile: #{skill_id}\n\n"
output += "The following is a natural language reconstruction of the structural definition:\n\n"
output += markdown
text_content(output)
end
|
#category ⇒ Object
15
16
17
|
# File 'lib/kairos_mcp/tools/definition_decompile.rb', line 15
def category
:skills
end
|
#description ⇒ Object
11
12
13
|
# File 'lib/kairos_mcp/tools/definition_decompile.rb', line 11
def description
'Decompile a skill\'s structural definition back to natural language. Shows what the AST nodes mean in human-readable form.'
end
|
#examples ⇒ Object
23
24
25
26
27
28
29
30
|
# File 'lib/kairos_mcp/tools/definition_decompile.rb', line 23
def examples
[
{
title: 'Decompile evolution_rules definition',
code: 'definition_decompile(skill_id: "evolution_rules")'
}
]
end
|
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/kairos_mcp/tools/definition_decompile.rb', line 36
def input_schema
{
type: 'object',
properties: {
skill_id: {
type: 'string',
description: 'The skill ID to decompile'
}
},
required: ['skill_id']
}
end
|
#name ⇒ Object
7
8
9
|
# File 'lib/kairos_mcp/tools/definition_decompile.rb', line 7
def name
'definition_decompile'
end
|
32
33
34
|
# File 'lib/kairos_mcp/tools/definition_decompile.rb', line 32
def related_tools
%w[definition_verify definition_drift skills_dsl_get]
end
|
19
20
21
|
# File 'lib/kairos_mcp/tools/definition_decompile.rb', line 19
def usecase_tags
%w[decompile definition AST natural-language reverse]
end
|