MT-22401: Add email campaigns tools - #128
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Aligned with the account-id fix from the Python/Node.js PRs: all 11 campaign handlers now call |
Decisions:
- 11 tools mirror src/tools/contactLists/ layout (one file per tool, schemas/, __tests__, barrel index.ts), registered after the contacts group in src/server.ts
- Handlers target the future mailtrap npm emailCampaigns surface via a local EmailCampaignsClient interface in src/types/mailtrap.ts with a single TODO(MT-22401) to drop the casts after the SDK release
- Single-object and stats responses unwrap the {data} envelope; list keeps {data, pagination} so page tokens stay visible; delete returns a {email_campaign_id, deleted: true} confirmation
- Zod validation layer added for list/create/update/schedule per repo CLAUDE.md recommendation
- readOnlyHint for list/get/stats; destructiveHint: true for create/update/delete and all five lifecycle tools per the MT-22401 plan
Decisions: - The email campaigns endpoints are token-scoped, so the handlers now pass requireAccountId: false (listAccounts precedent), matching the same fix in the Python and Node.js SDK PRs
a2d725e to
44d7081
Compare
Motivation
MT-22401
Port the Email Campaigns public API (MT-21113) to the MCP server.
Do not merge until mailtrap-nodejs#148 is released to npm and the
mailtrapdep is bumped here — handlers callclient.emailCampaigns.*, which doesn't exist in 4.8.0. Types compile today via a localEmailCampaignsClientinterface cast (marked with aTODO(MT-22401)to drop after the bump).Changes
list-email-campaigns,get-email-campaign,create-email-campaign,update-email-campaign,delete-email-campaign,start-email-campaign,schedule-email-campaign,cancel-email-campaign,terminate-email-campaign,reset-email-campaign,get-email-campaign-stats.strict()validation layer on list/create/update/schedule; lifecycle preconditions (draft-only, scheduled-only, sending-states) called out in tool descriptionsdataenvelope; list keeps{data, pagination}so page tokens stay usable; delete returns{email_campaign_id, deleted: true}How to test
mailtrapdep and real env vars, ask the MCP client to create a draft campaign, update its design, schedule and cancel it, fetch stats, then delete itFailed to cancel email campaign: ...message