Class: KairosMcp::Tools::StateCommit
- Inherits:
-
BaseTool
- Object
- BaseTool
- KairosMcp::Tools::StateCommit
show all
- Defined in:
- lib/kairos_mcp/tools/state_commit.rb
Overview
StateCommit: MCP tool for explicit state commits
Creates a snapshot of the current L0/L1/L2 state and records it to blockchain.
Instance Method Summary
collapse
Methods inherited from BaseTool
#initialize, #invoke_tool, #to_full_schema, #to_schema
Instance Method Details
#call(arguments) ⇒ Object
70
71
72
73
74
75
76
77
78
79
80
81
|
# File 'lib/kairos_mcp/tools/state_commit.rb', line 70
def call(arguments)
command = arguments['command'] || 'commit'
reason = arguments['reason']
force = arguments['force'] || false
case command
when 'commit'
handle_commit(reason, force)
else
text_content("Unknown command: #{command}")
end
end
|
#category ⇒ Object
21
22
23
|
# File 'lib/kairos_mcp/tools/state_commit.rb', line 21
def category
:state
end
|
#description ⇒ Object
17
18
19
|
# File 'lib/kairos_mcp/tools/state_commit.rb', line 17
def description
'Create a state commit (snapshot of L0/L1/L2 layers). Records to blockchain for auditability.'
end
|
#examples ⇒ Object
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/kairos_mcp/tools/state_commit.rb', line 29
def examples
[
{
title: 'Create a commit',
code: 'state_commit(reason: "Before major refactoring")'
},
{
title: 'Force commit',
code: 'state_commit(reason: "Checkpoint", force: true)'
}
]
end
|
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# File 'lib/kairos_mcp/tools/state_commit.rb', line 46
def input_schema
{
type: 'object',
properties: {
command: {
type: 'string',
description: 'Command: "commit" to create a commit',
enum: ['commit'],
default: 'commit'
},
reason: {
type: 'string',
description: 'Reason for the commit (required for explicit commits)'
},
force: {
type: 'boolean',
description: 'Force commit even if no changes detected (default: false)',
default: false
}
},
required: ['reason']
}
end
|
#name ⇒ Object
13
14
15
|
# File 'lib/kairos_mcp/tools/state_commit.rb', line 13
def name
'state_commit'
end
|
42
43
44
|
# File 'lib/kairos_mcp/tools/state_commit.rb', line 42
def related_tools
%w[state_status state_history chain_history]
end
|
25
26
27
|
# File 'lib/kairos_mcp/tools/state_commit.rb', line 25
def usecase_tags
%w[commit snapshot checkpoint save audit blockchain]
end
|