Class: KairosMcp::Tools::ChainHistory
- Inherits:
-
BaseTool
- Object
- BaseTool
- KairosMcp::Tools::ChainHistory
show all
- Defined in:
- lib/kairos_mcp/tools/chain_history.rb
Instance Method Summary
collapse
Methods inherited from BaseTool
#initialize, #invoke_tool, #to_full_schema, #to_schema
Instance Method Details
#call(arguments) ⇒ Object
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
# File 'lib/kairos_mcp/tools/chain_history.rb', line 67
def call(arguments)
limit = arguments['limit'] || 10
format = arguments['format'] || 'formatted'
type_filter = arguments['type'] || 'all'
chain = KairosChain::Chain.new
blocks = chain.chain.last(limit + 10).reverse
if type_filter != 'all'
blocks = blocks.select { |b| block_type(b) == type_filter }
end
blocks = blocks.first(limit)
if format == 'json'
text_content(JSON.pretty_generate(blocks.map(&:to_h)))
else
format_blocks(blocks)
end
end
|
#category ⇒ Object
16
17
18
|
# File 'lib/kairos_mcp/tools/chain_history.rb', line 16
def category
:chain
end
|
#description ⇒ Object
12
13
14
|
# File 'lib/kairos_mcp/tools/chain_history.rb', line 12
def description
'Get block history from the blockchain. Shows skill transitions, knowledge updates, and state commits.'
end
|
#examples ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
# File 'lib/kairos_mcp/tools/chain_history.rb', line 24
def examples
[
{
title: 'Get recent history',
code: 'chain_history(limit: 10)'
},
{
title: 'Filter by type',
code: 'chain_history(type: "skill_transition")'
},
{
title: 'Get raw JSON',
code: 'chain_history(format: "json")'
}
]
end
|
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
# File 'lib/kairos_mcp/tools/chain_history.rb', line 45
def input_schema
{
type: 'object',
properties: {
limit: {
type: 'integer',
description: 'Number of blocks to retrieve (default: 10)'
},
format: {
type: 'string',
description: 'Output format: "formatted" (human-readable, default) or "json" (raw)',
enum: %w[formatted json]
},
type: {
type: 'string',
description: 'Filter by block type: "all" (default), "state_commit", "skill_transition", "knowledge_update"',
enum: %w[all state_commit skill_transition knowledge_update]
}
}
}
end
|
#name ⇒ Object
8
9
10
|
# File 'lib/kairos_mcp/tools/chain_history.rb', line 8
def name
'chain_history'
end
|
41
42
43
|
# File 'lib/kairos_mcp/tools/chain_history.rb', line 41
def related_tools
%w[chain_status chain_verify state_history]
end
|
20
21
22
|
# File 'lib/kairos_mcp/tools/chain_history.rb', line 20
def usecase_tags
%w[history blocks blockchain audit trail log]
end
|