Files
leadchat/enterprise/app/services/captain/tools/copilot/get_contact_service.rb
Aakash Bakhle eed2eaceb0 feat: Migrate ruby llm captain (#12981)
Co-authored-by: aakashb95 <aakash@chatwoot.com>
Co-authored-by: Shivam Mishra <scm.mymail@gmail.com>
2025-12-04 18:26:10 +05:30

19 lines
541 B
Ruby

class Captain::Tools::Copilot::GetContactService < Captain::Tools::BaseTool
def self.name
'get_contact'
end
description 'Get details of a contact including their profile information'
param :contact_id, type: :number, desc: 'The ID of the contact to retrieve', required: true
def execute(contact_id:)
contact = Contact.find_by(id: contact_id, account_id: @assistant.account_id)
return 'Contact not found' if contact.nil?
contact.to_llm_text
end
def active?
user_has_permission('contact_manage')
end
end