Skip to content

feat: add email-metrics tool - #216

Merged
dielduarte merged 4 commits into
mainfrom
emails-metrics
Aug 24, 2026
Merged

dielduarte merged 4 commits into
mainfrom
emails-metrics

Conversation

@dielduarte

Copy link
Copy Markdown
Contributor

Adds an email-metrics MCP tool for account-level email metrics — period/domain/email/broadcast dimensions, domain_id/email_id/broadcast_id filters (broadcast and email mutually exclusive), all granularities.

Mirrors resend/resend-node#1079.

@dielduarte
dielduarte marked this pull request as ready for review August 22, 2026 13:42
@github-actions github-actions Bot added the linear-synced PR has been synced to Linear label Aug 23, 2026
dielduarte and others added 4 commits August 24, 2026 12:13
Bumps resend to 6.22.0 (adds Emails.metrics()) and exposes it as a new
email-metrics tool: period/domain/email/broadcast dimensions,
domain_id/email_id/broadcast_id filters, all granularities. Validates
the email/broadcast mutual exclusivity client-side before calling the
SDK, mirroring the existing after/before check in list-emails, since
the SDK's own guarantee here is compile-time only and MCP tool args
arrive as untyped JSON.
cubic isn't configured on this repo, so port over the same fixes
already applied to the equivalent tool in the private remote-mcp:
- Validate domainId/emailId/broadcastId as UUIDs, capped at 100 each.
- Prefer domain_name/broadcast_name over the raw id in breakdown row
  labels, falling back to the id only when the name is missing or an
  empty string (never drop the id without a usable replacement).
- Add matching test coverage: email dimension + broadcastId rejection,
  domainId/emailId positive passthrough, the broadcast_id symmetric
  fallback case, and the empty-string-name edge case.
Parity fix with the equivalent remote-mcp change: whitespace-only
domain_name/broadcast_name passed the length check and still produced
a blank-looking label. Also assert the exact breakdown label in the
id-fallback tests instead of a loose substring match.
Verb-first names are the convention here and in remote-mcp (get-email, list-emails, share-email). The remote-mcp twin gets the same rename so both surfaces stay identical. Add metrics to the Emails capability bullet, as #211 and #214 did for their tools.
@dielduarte
dielduarte merged commit ffe1520 into main Aug 24, 2026
4 checks passed
@dielduarte
dielduarte deleted the emails-metrics branch August 24, 2026 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linear-synced PR has been synced to Linear

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants