Class: RosettAi::Mcp::Tools::BehaviourManageTool
- Inherits:
-
Object
- Object
- RosettAi::Mcp::Tools::BehaviourManageTool
- Defined in:
- lib/rosett_ai/mcp/tools/behaviour_manage_tool.rb
Overview
MCP tool: manage behaviour files.
Add, modify, or delete behaviour configurations. Write operation — destructive when action is 'delete'.
Constant Summary collapse
- TOOL_NAME =
Returns MCP tool identifier string.
'rai_behaviour_manage'- DESCRIPTION =
Returns Human-readable description of this tool.
'Add, modify, or delete rai behaviour files'- ANNOTATIONS =
Returns MCP protocol annotations describing tool capabilities.
{ 'readOnlyHint' => false, 'destructiveHint' => true, 'idempotentHint' => false, 'openWorldHint' => false }.freeze
- VALID_ACTIONS =
Returns Set of permitted action values.
['add', 'modify', 'delete'].freeze
- INPUT_SCHEMA =
Returns JSON Schema defining the tool input parameters.
{ type: 'object', properties: { action: { type: 'string', enum: ['add', 'modify', 'delete'], description: 'Management action to perform' }, name: { type: 'string', description: 'Behaviour name' }, description: { type: 'string', description: 'Behaviour description (for add/modify)' }, force: { type: 'boolean', description: 'Skip confirmation for delete (default: false)' } }, required: ['action', 'name'] }.freeze
Instance Method Summary collapse
-
#call(action:, name:, description: nil, force: false) ⇒ Hash
Executes the behaviour management operation.
Instance Method Details
#call(action:, name:, description: nil, force: false) ⇒ Hash
Executes the behaviour management operation.
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/rosett_ai/mcp/tools/behaviour_manage_tool.rb', line 65 def call(action:, name:, description: nil, force: false) return ResponseHelper.error("Invalid action: #{action}") unless VALID_ACTIONS.include?(action) return ResponseHelper.error('Name is required') if name.nil? || name.empty? case action when 'add' then action_add(name, description: description) when 'modify' then action_modify(name, description: description) when 'delete' then action_delete(name, force: force) end rescue StandardError => e ResponseHelper.error("Behaviour #{action} failed: #{e.}") end |