Commit bb9b036
[21079] feat(gmail): add delete-label action (#21099)
* gmail: AI-optimized action set for MCP
Three new actions (find-emails, get-thread, modify-labels) plus flattened schemas
on existing write actions (send-email, create-draft, download-attachment) so every
parameter is statically visible to MCP — no more additionalProps / reloadProps /
async-options dropdowns.
- find-emails: native Gmail query syntax (`q`), `format` defaults to `metadata`
(headers + snippet only) so large inboxes don't blow through the token budget;
responses hard-capped at 100k chars with a `truncated: true` marker.
- get-thread: fetch an entire conversation by threadId; `metadata` vs `full` format.
- modify-labels: one tool replacing add-label / remove-label / archive /
bulk-archive / delete — archive is "remove INBOX", trash is "add TRASH",
star is "add STARRED", etc. Accepts label names or IDs.
- send-email / create-draft: replyAll is now a top-level static prop; new
`attachmentContent` (inline text) prop for MCP/cloud runs with no local
filesystem; `to`/`cc`/`bcc` accept `"me"` as a self-addressing shortcut
(resolved to the authenticated user's email address inside the action).
- create-label: colors are optional; idempotent on 409 (looks up the existing
label by name and returns it with `alreadyExisted: true`).
- download-attachment: messageId/attachmentId are plain strings instead of
async-options dropdowns; convertToPdf behaviour preserved.
- Shared parameters (attachments, attachmentFilenames, inReplyToMessageId,
replyAll) defined once on gmail.app.mjs propDefinitions; a resolveMe() helper
on the app expands "me" → auth'd email for recipient arrays.
Breaking schema changes on existing actions:
- send-email / create-draft: `inReplyTo` → `inReplyToMessageId`,
`attachmentUrlsOrPaths` → `attachments`.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* gmail: bump patch versions on components that depend on gmail.app.mjs
The app file changed (new propDefinitions, resolveMe helper, getMessage
signature), so every component that imports it needs a patch bump per the
component-versions CI check.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* gmail: consolidate duplicated actions into AI-optimized set
Collapse the legacy/new-file duplication left from the initial MCP
rewrite. Two 1:1 pairs merged in place (legacy key preserved, new
implementation wins), and five legacy label/archive/delete actions that
`modify-labels` fully supersedes are deleted.
- find-emails -> find-email (key preserved, version 0.1.11 -> 0.2.0,
display name "Find Emails"). Breaking prop changes: `labels` -> `labelIds`;
`metadataOnly`+`withTextPayload` -> `format: metadata|full`;
default maxResults 20 -> 25.
- get-thread -> list-thread-messages (key preserved, version 0.0.3 -> 0.1.0,
display name "Get Thread"). Now returns the full thread object
{id, historyId, messages[]} instead of the bare messages[] array; adds
optional `format` prop.
- Deleted: add-label-to-email, remove-label-from-email, archive-email,
bulk-archive-emails, delete-email — all strict subsets of
gmail-modify-labels (batchModify with addLabels/removeLabels).
- Fixed a "Find Email" -> "Find Emails" cross-reference in
get-current-user's description.
- Package version 1.5.2 -> 1.5.3.
Final AI-optimized action set: 9 files, zero duplicates. Existing workflows
using the preserved keys continue to resolve to the prior published version
until users opt into the new version.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* gmail: address CodeRabbit review on mcp/gmail
Fixes for the actionable findings from CodeRabbit's two-round review:
- download-attachment: sanitize `filename` via path.basename before
path.join(stashDir, filename), rejecting traversal or separators
(critical — crafted attachment name could escape stash dir); walk
message payload parts recursively so nested multipart attachments
resolve their MIME type instead of silently falling through.
- find-email: replace the "is-uppercase" label-resolution heuristic
with a proper byId/byName lookup so user labels like VIP or LEGAL
resolve correctly; use the shared utils.getHeader helper instead of
an inline closure.
- list-thread-messages: route through this.gmail.getThread({threadId,
format}) instead of bypassing the app abstraction via _client(); add
the same 100k-char response cap used by find-email, with a fallback
that degrades from `full` to `metadata`-level detail and then trims
from the tail if still oversized. Decoration moved to a method that
uses utils.getHeader.
- modify-labels: destructiveHint: false (batchModify is reversible
label mutation, not a permanent delete); same byId/byName label
resolution as find-email.
- send-email: throw ConfigurationError (not bare Error) for the
attachments/attachmentFilenames length mismatch — matches
@pipedream/platform convention for pre-flight input validation.
- gmail.app.mjs: getThread() now accepts an optional `format` param,
forwarded to users.threads.get, so list-thread-messages no longer
needs _client() access; narrow the reply-threading catch block so
only 404s fall back to using inReplyToMessageId as threadId — other
errors (auth, rate limit, network) rethrow instead of silently
producing a mis-threaded send.
- common/utils.mjs: add getHeader(headers, name) — shared,
case-insensitive header lookup used by find-email and
list-thread-messages.
Re-ran the 9 gmail evals: 9/9 pass, 100% tool coverage.
Nits intentionally not addressed:
- package.json major bump to 2.0.0 — breaking prop renames in the
Pipedream monorepo consistently ship under minor/patch bumps.
- removing the unused `$` parameter from getOptionsToSendEmail —
changing a shared app method signature for style alone is not
worth the downstream churn.
- O(n²) JSON.stringify in find-email truncation — bounded by
maxResults (default 25), negligible.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* gmail: address michelle + coderabbit round-2 review
Incorporating michelle0927's review feedback and the follow-up CodeRabbit
findings that landed after the first fix pass.
- package.json: 1.5.3 -> 2.0.0. Michelle requested the major bump given
the public prop contract changes (attachments rename, inReplyToMessageId,
top-level replyAll, etc.) — reversing my earlier call to keep it minor.
- Version corrections to match the original build-verification plan:
create-draft 0.3.0 -> 0.2.0, create-label 0.2.0 -> 0.1.0,
send-email 0.4.0 -> 0.3.0.
- create-draft: import ConfigurationError from @pipedream/platform and
use it (not bare Error) for the attachments/attachmentFilenames length
mismatch — matches the send-email fix from the previous round.
- gmail.app.mjs getOptionsToSendEmail: drop the unused `$` first
parameter; updated all three callers (send-email, create-draft,
approve-workflow) to match. CodeRabbit confirmed to Michelle that the
method body never referenced `$`. approve-workflow patch-bumped
(0.0.14 -> 0.0.15) since its call site changed.
- download-attachment: escape HTML special chars (`&`, `<`, `>`) before
wrapping plain-text attachments in <pre>...</pre> for PDF conversion.
Prevents code/XML/HTML-source attachments from being silently corrupted
(e.g. "<div>" swallowed as markup in the rendered PDF). New `escapeHtml`
helper in the methods object.
Re-ran evals: 9/9 pass, 100% tool coverage.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
* versions
* coderabbit suggestions
* feat(gmail): add delete-label action
* chore(gmail): update package version
* fix(gmail): address coderabbit review comments
* chore(gmail): update package versions
---------
Co-authored-by: Danny Roosevelt <danny@pipedream.com>
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
Co-authored-by: michelle0927 <michelle0927@users.noreply.github.com>
Co-authored-by: Michelle Bergeron <michelle.bergeron@ahp7jvtgvfr.celonis.cloud>1 parent ab130a8 commit bb9b036
24 files changed
Lines changed: 66 additions & 22 deletions
File tree
- components/gmail
- actions
- approve-workflow
- create-draft
- create-label
- delete-label
- download-attachment
- find-email
- get-current-user
- get-send-as-alias
- list-delegate-options
- list-labels
- list-send-as-aliases
- list-signature-options
- list-thread-messages
- modify-labels
- send-email
- update-org-signature
- update-primary-signature
- sources
- new-attachment-received
- new-email-matching-search
- new-email-received
- new-labeled-email
- new-sent-email
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | | - | |
| 27 | + | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
0 commit comments