Skip to main content
Glama
hdmt
by hdmt

create_draft_email

Create draft emails in HubSpot by defining campaign details, content, and recipient settings for marketing communications.

Instructions

メールの下書きを作成。既存メールを複製する場合はget_emailで取得したcontent等を渡す

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesキャンペーン名
subjectYesメール件名
htmlBodyNoHTML本文(シンプルなメール用)
contentNoメールコンテンツ構造(flexAreas, widgets等を含む詳細設定)
fromNo送信者情報 { fromName, replyTo }
subscriptionDetailsNo配信設定 { officeLocationId }
toNo送信先設定 { contactIlsLists, suppressGraymail }

Implementation Reference

  • The MCP tool handler that executes create_draft_email. It parses the request arguments using CreateDraftEmailSchema, calls the HubSpot client's createDraftEmail method, and returns a success message with the email ID, name, and subject.
    case 'create_draft_email': {
      const args = CreateDraftEmailSchema.parse(request.params.arguments);
      const result = await this.hubspot.createDraftEmail(
        args.name,
        args.subject,
        {
          htmlBody: args.htmlBody,
          content: args.content,
          from: args.from,
          subscriptionDetails: args.subscriptionDetails,
          to: args.to,
        }
      );
      return {
        content: [
          {
            type: 'text',
            text: `✅ メール下書きを作成しました\nID: ${result.id}\n名前: ${args.name}\n件名: ${args.subject}`,
          },
        ],
      };
    }
  • The HubSpot API client implementation of createDraftEmail. Constructs the email data object with name, subject, emailType 'BATCH_EMAIL', and state 'DRAFT', then optionally adds htmlBody, content, from, subscriptionDetails, and to fields before calling the createEmail method.
    async createDraftEmail(
      name: string,
      subject: string,
      options?: {
        htmlBody?: string;
        content?: any;
        from?: any;
        subscriptionDetails?: any;
        to?: any;
      }
    ) {
      const data: any = {
        name,
        subject,
        emailType: 'BATCH_EMAIL',
        state: 'DRAFT',
      };
      if (options?.htmlBody) {
        data.emailBody = options.htmlBody;
      }
      if (options?.content) {
        data.content = options.content;
      }
      if (options?.from) {
        data.from = options.from;
      }
      if (options?.subscriptionDetails) {
        data.subscriptionDetails = options.subscriptionDetails;
      }
      if (options?.to) {
        data.to = options.to;
      }
      return this.createEmail(data);
    }
  • Zod schema definition for CreateDraftEmailSchema. Validates the input parameters including required fields (name, subject) and optional fields (htmlBody, content, from, subscriptionDetails, to).
    export const CreateDraftEmailSchema = z.object({
      name: z.string().describe('メールキャンペーンの名前'),
      subject: z.string().describe('メールの件名'),
      htmlBody: z.string().optional().describe('HTMLメール本文(シンプルなメール用)'),
      content: z.any().optional().describe('メールコンテンツ構造(flexAreas, widgets等を含む詳細設定)'),
      from: z.any().optional().describe('送信者情報 { fromName, replyTo }'),
      subscriptionDetails: z.any().optional().describe('配信設定 { officeLocationId }'),
      to: z.any().optional().describe('送信先設定 { contactIlsLists, suppressGraymail }'),
    });
  • src/server.ts:64-78 (registration)
    Tool registration in the MCP server's tools list. Defines the create_draft_email tool with its description and input schema including required fields (name, subject) and optional fields (htmlBody, content, from, subscriptionDetails, to).
    name: 'create_draft_email',
    description: 'メールの下書きを作成。既存メールを複製する場合はget_emailで取得したcontent等を渡す',
    inputSchema: {
      type: 'object',
      properties: {
        name: { type: 'string', description: 'キャンペーン名' },
        subject: { type: 'string', description: 'メール件名' },
        htmlBody: { type: 'string', description: 'HTML本文(シンプルなメール用)' },
        content: { type: 'object', description: 'メールコンテンツ構造(flexAreas, widgets等を含む詳細設定)' },
        from: { type: 'object', description: '送信者情報 { fromName, replyTo }' },
        subscriptionDetails: { type: 'object', description: '配信設定 { officeLocationId }' },
        to: { type: 'object', description: '送信先設定 { contactIlsLists, suppressGraymail }' },
      },
      required: ['name', 'subject'],
    },
  • Helper method createEmail that performs the actual POST request to HubSpot's /marketing/v3/emails endpoint with the provided data. Called by createDraftEmail after constructing the email data object.
    async createEmail(data: any) {
      return this.request('/marketing/v3/emails', {
        method: 'POST',
        body: JSON.stringify(data),
      });
    }
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It states the tool creates a draft email, implying a write operation, but doesn't disclose behavioral traits such as permissions required, whether drafts are saved automatically, error handling, or rate limits. The mention of content reuse from 'get_email' adds some context, but critical mutation behaviors are undocumented.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is concise and front-loaded: the first sentence states the core purpose, and the second provides a usage tip. Both sentences earn their place by adding value. However, it could be slightly more structured by explicitly separating purpose from guidelines.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (7 parameters with nested objects, no output schema, and no annotations), the description is incomplete. It doesn't explain what happens after creation (e.g., draft ID returned, storage location), error conditions, or how parameters like 'content' and 'htmlBody' interact. For a mutation tool with rich inputs, more behavioral context is needed.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the schema already documents all 7 parameters thoroughly. The description adds minimal value beyond the schema: it hints that 'content' can be obtained from 'get_email' for cloning, but doesn't explain parameter interactions or usage semantics. With high schema coverage, the baseline score of 3 is appropriate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'メールの下書きを作成' (create a draft email). It specifies the verb (create) and resource (draft email), but doesn't explicitly differentiate from sibling tools like 'update_email' beyond mentioning 'get_email' for content reuse. The purpose is clear but sibling differentiation is limited to content sourcing.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides implied usage guidance: it suggests using 'get_email' to obtain content when cloning existing emails. However, it doesn't specify when to use this tool versus alternatives like 'update_email' or 'list_emails', nor does it mention prerequisites or exclusions. The guidance is helpful but incomplete.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/hdmt/hubspot-email-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server