feat: add email-metrics tool - #216
Merged
Merged
Conversation
dielduarte
marked this pull request as ready for review
August 22, 2026 13:42
felipefreitag
approved these changes
Aug 24, 2026
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.
dielduarte
force-pushed
the
emails-metrics
branch
from
August 24, 2026 15:13
da9ce79 to
c96232d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds an
email-metricsMCP 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.