Improvement(cc): added cc to gmail and outlook (#900)

* changed just gmail

* bun run lint

* fixed bcc

* updated docs

---------

Co-authored-by: Adam Gough <adamgough@Mac.attlocal.net>
Co-authored-by: waleedlatif1 <walif6@gmail.com>
This commit is contained in:
Adam Gough
2025-08-08 14:20:16 -07:00
committed by GitHub
parent 658942deb3
commit 7f39cd0f23
10 changed files with 127 additions and 23 deletions

View File

@@ -68,6 +68,8 @@ Send emails using Gmail
| `to` | string | Yes | Recipient email address |
| `subject` | string | Yes | Email subject |
| `body` | string | Yes | Email body content |
| `cc` | string | No | CC recipients \(comma-separated\) |
| `bcc` | string | No | BCC recipients \(comma-separated\) |
#### Output
@@ -87,6 +89,8 @@ Draft emails using Gmail
| `to` | string | Yes | Recipient email address |
| `subject` | string | Yes | Email subject |
| `body` | string | Yes | Email body content |
| `cc` | string | No | CC recipients \(comma-separated\) |
| `bcc` | string | No | BCC recipients \(comma-separated\) |
#### Output
@@ -107,13 +111,15 @@ Read emails from Gmail
| `folder` | string | No | Folder/label to read emails from |
| `unreadOnly` | boolean | No | Only retrieve unread messages |
| `maxResults` | number | No | Maximum number of messages to retrieve \(default: 1, max: 10\) |
| `includeAttachments` | boolean | No | Download and include email attachments |
#### Output
| Parameter | Type | Description |
| --------- | ---- | ----------- |
| `content` | string | Email content or summary |
| `metadata` | object | Email metadata |
| `content` | string | Text content of the email |
| `metadata` | json | Metadata of the email |
| `attachments` | file[] | Attachments of the email |
### `gmail_search`

View File

@@ -11,6 +11,7 @@
"exa",
"file",
"firecrawl",
"generic_webhook",
"github",
"gmail",
"google_calendar",

View File

@@ -182,6 +182,8 @@ Draft emails using Outlook
| `to` | string | Yes | Recipient email address |
| `subject` | string | Yes | Email subject |
| `body` | string | Yes | Email body content |
| `cc` | string | No | CC recipients \(comma-separated\) |
| `bcc` | string | No | BCC recipients \(comma-separated\) |
#### Output

View File

@@ -72,6 +72,27 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
condition: { field: 'operation', value: ['send_gmail', 'draft_gmail'] },
required: true,
},
// Advanced Settings - Additional Recipients
{
id: 'cc',
title: 'CC',
type: 'short-input',
layout: 'full',
placeholder: 'CC recipients (comma-separated)',
condition: { field: 'operation', value: ['send_gmail', 'draft_gmail'] },
mode: 'advanced',
required: false,
},
{
id: 'bcc',
title: 'BCC',
type: 'short-input',
layout: 'full',
placeholder: 'BCC recipients (comma-separated)',
condition: { field: 'operation', value: ['send_gmail', 'draft_gmail'] },
mode: 'advanced',
required: false,
},
// Label/folder selector (basic mode)
{
id: 'folder',
@@ -198,6 +219,8 @@ export const GmailBlock: BlockConfig<GmailToolResponse> = {
to: { type: 'string', description: 'Recipient email address' },
subject: { type: 'string', description: 'Email subject' },
body: { type: 'string', description: 'Email content' },
cc: { type: 'string', description: 'CC recipients (comma-separated)' },
bcc: { type: 'string', description: 'BCC recipients (comma-separated)' },
// Read operation inputs
folder: { type: 'string', description: 'Gmail folder' },
manualFolder: { type: 'string', description: 'Manual folder name' },

View File

@@ -60,6 +60,18 @@ export const gmailDraftTool: ToolConfig<GmailSendParams, GmailToolResponse> = {
visibility: 'user-or-llm',
description: 'Email body content',
},
cc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'CC recipients (comma-separated)',
},
bcc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'BCC recipients (comma-separated)',
},
},
request: {
@@ -70,14 +82,21 @@ export const gmailDraftTool: ToolConfig<GmailSendParams, GmailToolResponse> = {
'Content-Type': 'application/json',
}),
body: (params: GmailSendParams): Record<string, any> => {
const email = [
const emailHeaders = [
'Content-Type: text/plain; charset="UTF-8"',
'MIME-Version: 1.0',
`To: ${params.to}`,
`Subject: ${params.subject}`,
'',
params.body,
].join('\n')
]
if (params.cc) {
emailHeaders.push(`Cc: ${params.cc}`)
}
if (params.bcc) {
emailHeaders.push(`Bcc: ${params.bcc}`)
}
emailHeaders.push(`Subject: ${params.subject}`, '', params.body)
const email = emailHeaders.join('\n')
return {
message: {

View File

@@ -24,9 +24,9 @@ export const gmailReadTool: ToolConfig<GmailReadParams, GmailToolResponse> = {
},
outputs: {
content: { type: 'string' },
metadata: { type: 'json' },
attachments: { type: 'file[]' },
content: { type: 'string', description: 'Text content of the email' },
metadata: { type: 'json', description: 'Metadata of the email' },
attachments: { type: 'file[]', description: 'Attachments of the email' },
},
params: {

View File

@@ -53,6 +53,18 @@ export const gmailSendTool: ToolConfig<GmailSendParams, GmailToolResponse> = {
visibility: 'user-or-llm',
description: 'Email body content',
},
cc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'CC recipients (comma-separated)',
},
bcc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'BCC recipients (comma-separated)',
},
},
request: {
@@ -63,14 +75,21 @@ export const gmailSendTool: ToolConfig<GmailSendParams, GmailToolResponse> = {
'Content-Type': 'application/json',
}),
body: (params: GmailSendParams): Record<string, any> => {
const email = [
const emailHeaders = [
'Content-Type: text/plain; charset="UTF-8"',
'MIME-Version: 1.0',
`To: ${params.to}`,
`Subject: ${params.subject}`,
'',
params.body,
].join('\n')
]
if (params.cc) {
emailHeaders.push(`Cc: ${params.cc}`)
}
if (params.bcc) {
emailHeaders.push(`Bcc: ${params.bcc}`)
}
emailHeaders.push(`Subject: ${params.subject}`, '', params.body)
const email = emailHeaders.join('\n')
return {
raw: Buffer.from(email).toString('base64url'),

View File

@@ -8,6 +8,8 @@ interface BaseGmailParams {
// Send operation parameters
export interface GmailSendParams extends BaseGmailParams {
to: string
cc?: string
bcc?: string
subject: string
body: string
}

View File

@@ -37,6 +37,18 @@ export const outlookDraftTool: ToolConfig<OutlookDraftParams, OutlookDraftRespon
visibility: 'user-or-llm',
description: 'Email body content',
},
cc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'CC recipients (comma-separated)',
},
bcc: {
type: 'string',
required: false,
visibility: 'user-or-llm',
description: 'BCC recipients (comma-separated)',
},
},
outputs: {
@@ -65,20 +77,38 @@ export const outlookDraftTool: ToolConfig<OutlookDraftParams, OutlookDraftRespon
}
},
body: (params: OutlookDraftParams): Record<string, any> => {
return {
// Helper function to parse comma-separated emails
const parseEmails = (emailString?: string) => {
if (!emailString) return []
return emailString
.split(',')
.map((email) => email.trim())
.filter((email) => email.length > 0)
.map((email) => ({ emailAddress: { address: email } }))
}
const message: any = {
subject: params.subject,
body: {
contentType: 'Text',
content: params.body,
},
toRecipients: [
{
emailAddress: {
address: params.to,
},
},
],
toRecipients: parseEmails(params.to),
}
// Add CC if provided
const ccRecipients = parseEmails(params.cc)
if (ccRecipients.length > 0) {
message.ccRecipients = ccRecipients
}
// Add BCC if provided
const bccRecipients = parseEmails(params.bcc)
if (bccRecipients.length > 0) {
message.bccRecipients = bccRecipients
}
return message
},
},
transformResponse: async (response) => {

View File

@@ -36,6 +36,8 @@ export interface OutlookReadResponse extends ToolResponse {
export interface OutlookDraftParams {
accessToken: string
to: string
cc?: string
bcc?: string
subject: string
body: string
}