29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'lib/mail_mcp/tools/create_draft_mail_message_tool.rb', line 29
def self.call(to:, subject:, text_body:, server_context:, cc: nil, bcc: nil, html_body: nil,
attachment_urls: [], folder: "Drafts")
imap_config = server_context.imap_config
mail = MailBuilder.build(
from: imap_config[:username],
to: to, subject: subject, text_body: text_body,
cc: cc, bcc: bcc, html_body: html_body,
attachment_urls: attachment_urls
)
ImapClient.connect(imap_config) { |c| c.append_message(folder: folder, raw_message: mail.to_s) }
MCP::Tool::Response.new([{ type: "text", text: "Draft saved to #{folder}" }])
end
|