Class: Legion::MCP::Tools::SkillCancel

Inherits:
MCP::Tool
  • Object
show all
Extended by:
Logging::Helper
Defined in:
lib/legion/mcp/tools/skills.rb

Class Method Summary collapse

Class Method Details

.call(conversation_id:) ⇒ Object



201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
# File 'lib/legion/mcp/tools/skills.rb', line 201

def call(conversation_id:)
  log.info('Starting legion.mcp.tools.skill_cancel.call')
  return error_response('ConversationStore not available') unless defined?(Legion::LLM::ConversationStore)

  result = Legion::LLM::ConversationStore.cancel_skill!(conversation_id)
  if result
    text_response({ cancelled: true, skill_key: result[:skill_key] })
  else
    text_response({ cancelled: false, reason: 'not_running' })
  end
rescue StandardError => e
  handle_exception(e, level: :warn, operation: 'legion.mcp.tools.skill_cancel.call')
  log.warn("SkillCancel#call failed: #{e.message}")
  error_response("Failed to cancel skill: #{e.message}")
end