Skip to main content
Glama
Garoth

SendGrid MCP Server

by Garoth

send_to_list

Send email campaigns to contact lists using SendGrid Single Sends. Define recipients, compose content, and manage unsubscribes for targeted email marketing.

Instructions

Send an email to a contact list using SendGrid Single Sends

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
nameYesName of the single send
list_idsYesArray of list IDs to send to
subjectYesEmail subject line
html_contentYesHTML content of the email
plain_contentYesPlain text content of the email
sender_idYesID of the verified sender
suppression_group_idNoID of the suppression group for unsubscribes (required if custom_unsubscribe_url not provided)
custom_unsubscribe_urlNoCustom URL for unsubscribes (required if suppression_group_id not provided)

Implementation Reference

  • Handler for the 'send_to_list' tool. Validates unsubscribe settings, creates a SendGrid Single Send targeting the provided list_ids, configures the email, and schedules immediate sending via SendGridService.
    case 'send_to_list':
      if (!args.suppression_group_id && !args.custom_unsubscribe_url) {
        throw new Error('Either suppression_group_id or custom_unsubscribe_url must be provided');
      }
    
      const newSingleSend = await service.createSingleSend({
        name: args.name,
        send_to: {
          list_ids: args.list_ids
        },
        email_config: {
          subject: args.subject,
          html_content: args.html_content,
          plain_content: args.plain_content,
          sender_id: args.sender_id,
          suppression_group_id: args.suppression_group_id,
          custom_unsubscribe_url: args.custom_unsubscribe_url
        }
      });
      
      // Schedule it to send immediately
      await service.scheduleSingleSend(newSingleSend.id, 'now');
      
      return {
        content: [{
          type: 'text',
          text: `Email "${args.name}" has been sent to the specified lists`
        }]
      };
  • Input schema definition for the 'send_to_list' tool, defining parameters like name, list_ids, subject, contents, sender_id, and unsubscribe options.
      name: 'send_to_list',
      description: 'Send an email to a contact list using SendGrid Single Sends',
      inputSchema: {
        type: 'object',
        properties: {
          name: {
            type: 'string',
            description: 'Name of the single send'
          },
          list_ids: {
            type: 'array',
            items: {
              type: 'string'
            },
            description: 'Array of list IDs to send to'
          },
          subject: {
            type: 'string',
            description: 'Email subject line'
          },
          html_content: {
            type: 'string',
            description: 'HTML content of the email'
          },
          plain_content: {
            type: 'string',
            description: 'Plain text content of the email'
          },
          sender_id: {
            type: 'number',
            description: 'ID of the verified sender'
          },
          suppression_group_id: {
            type: 'number',
            description: 'ID of the suppression group for unsubscribes (required if custom_unsubscribe_url not provided)'
          },
          custom_unsubscribe_url: {
            type: 'string',
            description: 'Custom URL for unsubscribes (required if suppression_group_id not provided)'
          }
        },
        required: ['name', 'list_ids', 'subject', 'html_content', 'plain_content', 'sender_id']
      }
    },
  • The getToolDefinitions function registers the 'send_to_list' tool schema by including it in the array of tool definitions exported for use in the MCP server.
    export const getToolDefinitions = (service: SendGridService) => [
      {
        name: 'delete_contacts',
        description: 'Delete contacts from your SendGrid account',
        inputSchema: {
          type: 'object',
          properties: {
            emails: {
              type: 'array',
              items: {
                type: 'string'
              },
              description: 'Array of email addresses to delete'
            }
          },
          required: ['emails']
        }
      },
      {
        name: 'list_contacts',
        description: 'List all contacts in your SendGrid account',
        inputSchema: {
          type: 'object',
          properties: {},
          required: []
        }
      },
      {
        name: 'send_email',
        description: 'Send an email using SendGrid',
        inputSchema: {
          type: 'object',
          properties: {
            to: {
              type: 'string',
              description: 'Recipient email address'
            },
            subject: {
              type: 'string',
              description: 'Email subject line'
            },
            text: {
              type: 'string',
              description: 'Plain text content of the email'
            },
            html: {
              type: 'string',
              description: 'HTML content of the email (optional)'
            },
            from: {
              type: 'string',
              description: 'Sender email address (must be verified with SendGrid)'
            },
            template_id: {
              type: 'string',
              description: 'SendGrid template ID (optional)'
            },
            dynamic_template_data: {
              type: 'object',
              description: 'Dynamic data for template variables (optional)'
            }
          },
          required: ['to', 'subject', 'text', 'from']
        }
      },
      {
        name: 'add_contact',
        description: 'Add a contact to your SendGrid marketing contacts',
        inputSchema: {
          type: 'object',
          properties: {
            email: {
              type: 'string',
              description: 'Contact email address'
            },
            first_name: {
              type: 'string',
              description: 'Contact first name (optional)'
            },
            last_name: {
              type: 'string',
              description: 'Contact last name (optional)'
            },
            custom_fields: {
              type: 'object',
              description: 'Custom field values (optional)'
            }
          },
          required: ['email']
        }
      },
      {
        name: 'create_contact_list',
        description: 'Create a new contact list in SendGrid',
        inputSchema: {
          type: 'object',
          properties: {
            name: {
              type: 'string',
              description: 'Name of the contact list'
            }
          },
          required: ['name']
        }
      },
      {
        name: 'add_contacts_to_list',
        description: 'Add contacts to an existing SendGrid list',
        inputSchema: {
          type: 'object',
          properties: {
            list_id: {
              type: 'string',
              description: 'ID of the contact list'
            },
            emails: {
              type: 'array',
              items: {
                type: 'string'
              },
              description: 'Array of email addresses to add to the list'
            }
          },
          required: ['list_id', 'emails']
        }
      },
      {
        name: 'create_template',
        description: 'Create a new email template in SendGrid',
        inputSchema: {
          type: 'object',
          properties: {
            name: {
              type: 'string',
              description: 'Name of the template'
            },
            subject: {
              type: 'string',
              description: 'Default subject line for the template'
            },
            html_content: {
              type: 'string',
              description: 'HTML content of the template'
            },
            plain_content: {
              type: 'string',
              description: 'Plain text content of the template'
            }
          },
          required: ['name', 'subject', 'html_content', 'plain_content']
        }
      },
      {
        name: 'get_template',
        description: 'Retrieve a SendGrid template by ID',
        inputSchema: {
          type: 'object',
          properties: {
            template_id: {
              type: 'string',
              description: 'ID of the template to retrieve'
            }
          },
          required: ['template_id']
        }
      },
      {
        name: 'delete_template',
        description: 'Delete a dynamic template from SendGrid',
        inputSchema: {
          type: 'object',
          properties: {
            template_id: {
              type: 'string',
              description: 'ID of the template to delete'
            }
          },
          required: ['template_id']
        }
      },
      {
        name: 'validate_email',
        description: 'Validate an email address using SendGrid',
        inputSchema: {
          type: 'object',
          properties: {
            email: {
              type: 'string',
              description: 'Email address to validate'
            }
          },
          required: ['email']
        }
      },
      {
        name: 'get_stats',
        description: 'Get SendGrid email statistics',
        inputSchema: {
          type: 'object',
          properties: {
            start_date: {
              type: 'string',
              description: 'Start date in YYYY-MM-DD format'
            },
            end_date: {
              type: 'string',
              description: 'End date in YYYY-MM-DD format (optional)'
            },
            aggregated_by: {
              type: 'string',
              enum: ['day', 'week', 'month'],
              description: 'How to aggregate the statistics (optional)'
            }
          },
          required: ['start_date']
        }
      },
      {
        name: 'list_templates',
        description: 'List all email templates in your SendGrid account',
        inputSchema: {
          type: 'object',
          properties: {},
          required: []
        }
      },
      {
        name: 'delete_list',
        description: 'Delete a contact list from SendGrid',
        inputSchema: {
          type: 'object',
          properties: {
            list_id: {
              type: 'string',
              description: 'ID of the contact list to delete'
            }
          },
          required: ['list_id']
        }
      },
      {
        name: 'list_contact_lists',
        description: 'List all contact lists in your SendGrid account',
        inputSchema: {
          type: 'object',
          properties: {},
          required: []
        }
      },
      {
        name: 'get_contacts_by_list',
        description: 'Get all contacts in a SendGrid list',
        inputSchema: {
          type: 'object',
          properties: {
            list_id: {
              type: 'string',
              description: 'ID of the contact list'
            }
          },
          required: ['list_id']
        }
      },
      {
        name: 'list_verified_senders',
        description: 'List all verified sender identities in your SendGrid account',
        inputSchema: {
          type: 'object',
          properties: {},
          required: []
        }
      },
      {
        name: 'list_suppression_groups',
        description: 'List all unsubscribe groups in your SendGrid account',
        inputSchema: {
          type: 'object',
          properties: {},
          required: []
        }
      },
      {
        name: 'send_to_list',
        description: 'Send an email to a contact list using SendGrid Single Sends',
        inputSchema: {
          type: 'object',
          properties: {
            name: {
              type: 'string',
              description: 'Name of the single send'
            },
            list_ids: {
              type: 'array',
              items: {
                type: 'string'
              },
              description: 'Array of list IDs to send to'
            },
            subject: {
              type: 'string',
              description: 'Email subject line'
            },
            html_content: {
              type: 'string',
              description: 'HTML content of the email'
            },
            plain_content: {
              type: 'string',
              description: 'Plain text content of the email'
            },
            sender_id: {
              type: 'number',
              description: 'ID of the verified sender'
            },
            suppression_group_id: {
              type: 'number',
              description: 'ID of the suppression group for unsubscribes (required if custom_unsubscribe_url not provided)'
            },
            custom_unsubscribe_url: {
              type: 'string',
              description: 'Custom URL for unsubscribes (required if suppression_group_id not provided)'
            }
          },
          required: ['name', 'list_ids', 'subject', 'html_content', 'plain_content', 'sender_id']
        }
      },
      {
        name: 'get_single_send',
        description: 'Get details of a specific single send',
        inputSchema: {
          type: 'object',
          properties: {
            single_send_id: {
              type: 'string',
              description: 'ID of the single send to retrieve'
            }
          },
          required: ['single_send_id']
        }
      },
      {
        name: 'list_single_sends',
        description: 'List all single sends in your SendGrid account',
        inputSchema: {
          type: 'object',
          properties: {},
          required: []
        }
      },
      {
        name: 'remove_contacts_from_list',
        description: 'Remove contacts from a SendGrid list without deleting them',
        inputSchema: {
          type: 'object',
          properties: {
            list_id: {
              type: 'string',
              description: 'ID of the contact list'
            },
            emails: {
              type: 'array',
              items: {
                type: 'string'
              },
              description: 'Array of email addresses to remove from the list'
            }
          },
          required: ['list_id', 'emails']
        }
      }
    ];
Behavior2/5

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

With no annotations provided, the description carries the full burden of behavioral disclosure. It mentions 'SendGrid Single Sends' which hints at a bulk email operation, but fails to describe critical traits like whether this is a one-time send, if it's asynchronous, what permissions are required, rate limits, or what happens on failure. For a tool with 8 parameters and no annotations, this is a significant gap in transparency.

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

Conciseness5/5

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

The description is a single, efficient sentence that directly states the tool's purpose without unnecessary words. It's front-loaded with the core action and resource, making it easy to parse quickly. Every word earns its place in this concise formulation.

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 of an email-sending tool with 8 parameters, no annotations, and no output schema, the description is incomplete. It doesn't address behavioral aspects like error handling, response format, or operational constraints. For a tool that likely involves external API calls and mutation, more context is needed to use it effectively and safely.

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 8 parameters thoroughly. The description adds no additional parameter semantics beyond what's in the schema, such as explaining relationships between parameters (e.g., the mutual exclusivity of suppression_group_id and custom_unsubscribe_url). Baseline 3 is appropriate when the schema does the heavy lifting.

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 action ('Send an email') and target resource ('to a contact list using SendGrid Single Sends'), which is specific and unambiguous. However, it doesn't explicitly differentiate from the sibling 'send_email' tool, which appears to be a similar email-sending function, leaving some ambiguity about when to choose one over the other.

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

Usage Guidelines2/5

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

The description provides no guidance on when to use this tool versus alternatives like 'send_email' or other email-related siblings. It lacks context about prerequisites, appropriate scenarios, or exclusions, leaving the agent to infer usage from the tool name and parameters alone.

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/Garoth/sendgrid-mcp'

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