Class: RosettAi::Mcp::Tools::HooksStatusTool
- Inherits:
-
Object
- Object
- RosettAi::Mcp::Tools::HooksStatusTool
- Defined in:
- lib/rosett_ai/mcp/tools/hooks_status_tool.rb
Overview
MCP tool: show git hooks status.
Lists configured hooks and their installation status. Read-only operation.
Constant Summary collapse
- TOOL_NAME =
'rai_hooks_status'- DESCRIPTION =
'Show git hooks list and installation status'- ANNOTATIONS =
{ 'readOnlyHint' => true, 'destructiveHint' => false, 'idempotentHint' => true, 'openWorldHint' => false }.freeze
- VALID_ACTIONS =
['list', 'status'].freeze
Instance Method Summary collapse
-
#call(action: 'status') ⇒ Hash
Executes the hooks query.
Instance Method Details
#call(action: 'status') ⇒ Hash
Executes the hooks query.
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/rosett_ai/mcp/tools/hooks_status_tool.rb', line 33 def call(action: 'status') return ResponseHelper.error("Invalid action: #{action}") unless VALID_ACTIONS.include?(action) hooks_config = RosettAi.root.join('.overcommit.yml') return ResponseHelper.error('No .overcommit.yml found') unless hooks_config.exist? data = YAML.safe_load_file(hooks_config, permitted_classes: [Symbol]) { action: action, installed: RosettAi.root.join('.git', 'hooks', 'overcommit-hook').exist?, hooks: extract_hooks(data) } rescue Psych::SyntaxError => e ResponseHelper.error("Hooks config parse error: #{e.}") end |