-
Notifications
You must be signed in to change notification settings - Fork 1
feat(gmail): add sendBatch operation with throttling and dryRun flag #60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -249,6 +249,18 @@ export async function generateToolStructure(): Promise<ModuleStructure> { | |
| description: 'Preview a rendered templated email without sending. Returns rendered subject, body, and recipients. Pure function — no API calls.', | ||
| example: 'const preview = gmail.dryRun({ to: ["amy@example.com"], subject: "{{firstName}}, quick follow-up", template: "Hey {{firstName}},\\n\\n{{note}}", variables: { firstName: "Amy", note: "checking in" } });\nconsole.log(preview.subject); // "Amy, quick follow-up"\nconsole.log(preview.wouldSend); // false', | ||
| }, | ||
| { | ||
| name: 'sendFromTemplate', | ||
| signature: 'sendFromTemplate({ to: string[], subject: string, template: string, variables: Record<string, string>, cc?: string[], bcc?: string[], isHtml?: boolean, from?: string })', | ||
| description: 'Render a templated email ({{variable}} substitution in subject and body) and send it. Returns messageId and threadId.', | ||
| example: 'const result = await gmail.sendFromTemplate({ to: ["amy@example.com"], subject: "{{firstName}}, quick follow-up", template: "Hey {{firstName}},\\n\\n{{personalNote}}", variables: { firstName: "Amy", personalNote: "Great chat!" } });\nconsole.log(result.messageId);', | ||
| }, | ||
| { | ||
| name: 'sendBatch', | ||
| signature: 'sendBatch({ subject: string, template: string, recipients: Array<{ to: string, variables: Record<string, string>, cc?: string[], bcc?: string[] }>, delayMs?: number, isHtml?: boolean, dryRun?: boolean, from?: string })', | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Line 260 includes 🤖 Prompt for AI Agents |
||
| description: 'Send templated emails to multiple recipients with per-recipient variable substitution and configurable delay between sends (default 5000ms). Set dryRun: true to preview all rendered emails without sending. Returns { sent, failed, results?, previews? }.', | ||
| example: 'const result = await gmail.sendBatch({ subject: "Hi {{name}}", template: "Hello {{name}}, {{note}}", recipients: [{ to: "alice@example.com", variables: { name: "Alice", note: "checking in" } }, { to: "bob@example.com", variables: { name: "Bob", note: "quick update" } }], delayMs: 5000 });\nconsole.log(`Sent: ${result.sent}, Failed: ${result.failed}`);', | ||
|
Comment on lines
+261
to
+262
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Default throttling value conflicts with linked requirement. Line 261 (and the example on Line 262) documents a default of 🤖 Prompt for AI Agents |
||
| }, | ||
|
Comment on lines
+252
to
+263
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Use the operation-based tool shape instead of adding action-specific entries. Lines 252-263 add separate As per coding guidelines, " 🤖 Prompt for AI Agents |
||
| ], | ||
| calendar: [ | ||
| { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new
sendBatchsignature in tool discovery advertisesrecipients[].cc/recipients[].bcc, but the actual operation only supports{ to, variables }per recipient (BatchRecipient) andsendBatch()only readsrecipient.toandrecipient.variablesbefore callingsendMessage. In practice, callers that rely ongdrive://toolswill provide per-recipient CC/BCC and silently get incorrect behavior (those recipients are never included), which makes this discovery metadata inaccurate and misleading.Useful? React with 👍 / 👎.