20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'lib/legion/mcp/tools/delete_chain.rb', line 20
def call(id:)
log.info('Starting legion.mcp.tools.delete_chain.call')
return error_response('legion-data is not connected') unless data_connected?
return error_response('chain data model is not available') unless chain_model?
record = Legion::Data::Model::Chain[id.to_i]
return error_response("Chain #{id} not found") unless record
record.delete
text_response({ deleted: true, id: id })
rescue StandardError => e
handle_exception(e, level: :warn, operation: 'legion.mcp.tools.delete_chain.call')
log.warn("DeleteChain#call failed: #{e.message}")
error_response("Failed to delete chain: #{e.message}")
end
|