update_email
Modify existing HubSpot marketing emails by updating campaign names, subject lines, HTML content, or structured content elements to refine email campaigns.
Instructions
メールを更新
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| emailId | Yes | メールID | |
| name | No | キャンペーン名 | |
| subject | No | メール件名 | |
| htmlBody | No | HTML本文(シンプルなメール用) | |
| content | No | メールコンテンツ構造(flexAreas, widgets等を含む詳細設定) |
Implementation Reference
- src/server.ts:141-155 (handler)The main handler for update_email tool that parses arguments, constructs update data object, and calls the HubSpot client's updateEmail method. It optionally includes name, subject, htmlBody, and content fields based on provided arguments.case 'update_email': { const args = UpdateEmailSchema.parse(request.params.arguments); const updateData: any = {}; if (args.name) updateData.name = args.name; if (args.subject) updateData.subject = args.subject; if (args.htmlBody) updateData.emailBody = args.htmlBody; if (args.content) updateData.content = args.content; const result = await this.hubspot.updateEmail(args.emailId, updateData); return { content: [ { type: 'text', text: `✅ メールを更新しました\n${JSON.stringify(result, null, 2)}` }, ], }; }
- src/hubspot/client.ts:50-55 (handler)The actual implementation in HubSpotClient that makes a PATCH request to the HubSpot Marketing API endpoint '/marketing/v3/emails/{emailId}' to update an email with the provided data.async updateEmail(emailId: string, data: any) { return this.request(`/marketing/v3/emails/${emailId}`, { method: 'PATCH', body: JSON.stringify(data), }); }
- src/tools/types.ts:23-29 (schema)The Zod schema definition for UpdateEmailSchema that validates input parameters: emailId (required string), name (optional string), subject (optional string), htmlBody (optional string), and content (optional any).export const UpdateEmailSchema = z.object({ emailId: z.string(), name: z.string().optional(), subject: z.string().optional(), htmlBody: z.string().optional().describe('HTMLメール本文(シンプルなメール用)'), content: z.any().optional().describe('メールコンテンツ構造(flexAreas, widgets等を含む詳細設定)'), });
- src/server.ts:81-93 (registration)Tool registration in the MCP server that defines the update_email tool with its description, input schema properties (emailId, name, subject, htmlBody, content), and required fields (emailId).name: 'update_email', description: 'メールを更新', inputSchema: { type: 'object', properties: { emailId: { type: 'string', description: 'メールID' }, name: { type: 'string', description: 'キャンペーン名' }, subject: { type: 'string', description: 'メール件名' }, htmlBody: { type: 'string', description: 'HTML本文(シンプルなメール用)' }, content: { type: 'object', description: 'メールコンテンツ構造(flexAreas, widgets等を含む詳細設定)' }, }, required: ['emailId'], },